@origintrail-official/dkg-node-ui 10.0.1 → 10.0.3

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.
Files changed (59) hide show
  1. package/dist/chain-cursor-stores.d.ts +45 -0
  2. package/dist/chain-cursor-stores.d.ts.map +1 -0
  3. package/dist/chain-cursor-stores.js +107 -0
  4. package/dist/chain-cursor-stores.js.map +1 -0
  5. package/dist/chat-memory.d.ts +0 -17
  6. package/dist/chat-memory.d.ts.map +1 -1
  7. package/dist/chat-memory.js +6 -33
  8. package/dist/chat-memory.js.map +1 -1
  9. package/dist/db.d.ts +15 -0
  10. package/dist/db.d.ts.map +1 -1
  11. package/dist/db.js +40 -1
  12. package/dist/db.js.map +1 -1
  13. package/dist/index.d.ts +6 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +6 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/notifications-scope.d.ts +19 -0
  18. package/dist/notifications-scope.d.ts.map +1 -1
  19. package/dist/notifications-scope.js +34 -2
  20. package/dist/notifications-scope.js.map +1 -1
  21. package/dist/otlp-log-worker.d.ts +127 -0
  22. package/dist/otlp-log-worker.d.ts.map +1 -0
  23. package/dist/otlp-log-worker.js +268 -0
  24. package/dist/otlp-log-worker.js.map +1 -0
  25. package/dist/telemetry-resource.d.ts +41 -0
  26. package/dist/telemetry-resource.d.ts.map +1 -0
  27. package/dist/telemetry-resource.js +31 -0
  28. package/dist/telemetry-resource.js.map +1 -0
  29. package/dist/telemetry.d.ts +75 -16
  30. package/dist/telemetry.d.ts.map +1 -1
  31. package/dist/telemetry.js +152 -29
  32. package/dist/telemetry.js.map +1 -1
  33. package/dist-ui/assets/{3d-force-graph-DII0C0lY.js → 3d-force-graph-DRDhpplH.js} +1 -1
  34. package/dist-ui/assets/AgentHub-DdUAxJoy.js +1 -0
  35. package/dist-ui/assets/AgentProfilePage-yI8fA4vv.js +1 -0
  36. package/dist-ui/assets/ApproveWalletsModal-9w2edv7e.js +57 -0
  37. package/dist-ui/assets/ConvictionDetailView-CcQMya-y.js +2 -0
  38. package/dist-ui/assets/Network-DpAKVzwi.js +1 -0
  39. package/dist-ui/assets/OnChainProvenanceCard-DMOm3jLz.js +1 -0
  40. package/dist-ui/assets/{Operations-BC6Cv6cR.js → Operations-DKJFp6hM.js} +3 -3
  41. package/dist-ui/assets/PublishingConviction-1CPHxNwp.js +2 -0
  42. package/dist-ui/assets/Settings-DaYMlGHD.js +1 -0
  43. package/dist-ui/assets/ccip-hCQYqfNz.js +1 -0
  44. package/dist-ui/assets/{index-D0Mz0SVt.js → index-Bh_8bMB0.js} +3 -3
  45. package/dist-ui/assets/{index-ByLJSVQ3.js → index-CVwCoJrM.js} +9 -9
  46. package/dist-ui/assets/index-D5UiTYlY.css +1 -0
  47. package/dist-ui/assets/index-DGpnb_b1.js +1661 -0
  48. package/dist-ui/assets/{jsonld-32FQRO67-B4_tUX65.js → jsonld-32FQRO67-C3B_LjZ-.js} +2 -2
  49. package/dist-ui/assets/{jsonld-D5RXTCJi.js → jsonld-CoPRWQuM.js} +1 -1
  50. package/dist-ui/assets/{renderer-3d-2EVDZII7-BTYEjwma.js → renderer-3d-2EVDZII7-Bx6o7Gge.js} +2 -2
  51. package/dist-ui/index.html +2 -2
  52. package/package.json +14 -3
  53. package/dist-ui/assets/AgentHub-D3eOrb3Z.js +0 -1
  54. package/dist-ui/assets/AgentProfilePage-jB-v9soG.js +0 -1
  55. package/dist-ui/assets/Network-d4igcZQ0.js +0 -1
  56. package/dist-ui/assets/OnChainProvenanceCard-BL6ou6s9.js +0 -1
  57. package/dist-ui/assets/Settings-DXSjvx2a.js +0 -1
  58. package/dist-ui/assets/index-B6UQm9N_.js +0 -1670
  59. package/dist-ui/assets/index-BgRu6zNc.css +0 -1
@@ -0,0 +1,2 @@
1
+ import{ap as i,z as ie,a8 as de,aI as _,aD as ee,Q as pe,ak as ue,v as ge,a9 as xe,aN as D,ad as e,$ as be,S as fe,Z as ne,a1 as Ce,ah as je,ab as Ne,X as ye,Y as ke,j as Ae,n as Pe,aB as Ie,aM as Se,ac as Ee,aG as Te,aa as ce,o as J,av as ae,ag as Re,an as We,E as $e}from"./index-DGpnb_b1.js";import{u as Me,v as oe,H as Oe,f as q,t as Be,z as Fe,P as De,w as Ue,W as Le,C as Ge,a as _e}from"./ApproveWalletsModal-9w2edv7e.js";function Ve(){const[t,s]=i.useState("loading"),[c,l]=i.useState(0);return i.useEffect(()=>{let h=!0;return s("loading"),ie("0").then(()=>{h&&s("available")}).catch(d=>{h&&s(de(d)?"unavailable":"available")}),()=>{h=!1}},[c]),{status:t,recheck:()=>l(h=>h+1)}}function Ye(t){const{accountId:s,relation:c,...l}=t;return l}function ze(t,s){return t===s?t:"both"}function qe(){const t=_(n=>n.trackedIds),s=_(n=>n.trackAccount),{data:c,loading:l,refresh:h}=ee(async()=>{let n=!1;const p=await pe().catch(()=>(n=!0,null));typeof(p==null?void 0:p.error)=="string"&&p.error.length>0&&(n=!0);const o=(p==null?void 0:p.wallets)??[],v=(await Promise.all(o.map(async g=>{const N=await ue(g).catch(()=>(n=!0,null));return N!=null&&N.accountId?{accountId:N.accountId,wallet:g}:null}))).filter(g=>g!=null);let u=[],C=!1;try{u=(await ge({hydrate:!0})).accounts}catch(g){de(g)&&!xe(g)?u=[]:C=!0}return{agentPairs:v,mine:u,ownedError:C,agentError:n}},[],0),d=i.useMemo(()=>{const n=new Map;for(const p of(c==null?void 0:c.mine)??[])n.set(p.accountId,{accountId:p.accountId,relation:p.relation,basics:Ye(p)});for(const p of(c==null?void 0:c.agentPairs)??[]){const o=n.get(p.accountId);o?(o.relation=ze(o.relation,"agent"),o.agentWallet||(o.agentWallet=p.wallet)):n.set(p.accountId,{accountId:p.accountId,relation:"agent",agentWallet:p.wallet})}return[...n.values()]},[c]);i.useEffect(()=>{for(const n of d)(n.relation==="agent"||n.relation==="both")&&!t.includes(n.accountId)&&s(n.accountId)},[d,t,s]);const x=i.useMemo(()=>d.filter(n=>!t.includes(n.accountId)),[d,t]);return{discovered:d,untracked:x,ownedError:(c==null?void 0:c.ownedError)??!1,agentError:(c==null?void 0:c.agentError)??!1,loading:l,refresh:h}}function He(){const t=D(n=>n.address),s=D(n=>n.bootstrap),[c,l]=i.useState({loading:!1,error:null,ids:[]}),[h,d]=i.useState(0);i.useEffect(()=>{let n=!1;async function p(o,v){var u;l(C=>({...C,loading:!0,error:null}));try{if(!((u=o.rpcUrls)!=null&&u.length))throw new Error("No PCA RPC endpoints were provided.");const C=Me(o.chainId,o.rpcUrls),g=o.nft,N=v,T=await C.readContract({address:g,abi:oe,functionName:"balanceOf",args:[N]}),S=[],m=typeof T=="bigint"?T:BigInt(String(T));for(let y=0n;y<m;y+=1n){const k=await C.readContract({address:g,abi:oe,functionName:"tokenOfOwnerByIndex",args:[N,y]});S.push((typeof k=="bigint"?k:BigInt(String(k))).toString())}if(n)return;l({loading:!1,error:null,ids:S})}catch(C){if(n)return;l({loading:!1,error:(C==null?void 0:C.message)??"Could not read connected-wallet PCAs.",ids:[]})}}return!t||!s?(l({loading:!1,error:null,ids:[]}),()=>{n=!0}):(p(s,t),()=>{n=!0})},[t,s,h]);const x=i.useCallback(()=>d(n=>n+1),[]);return{ids:c.ids,loading:c.loading,error:c.error,refresh:x}}function re(t){if(typeof t!="number"||!Number.isFinite(t))return"—";const s=t/100;return`${s%1===0?s.toFixed(0):s.toFixed(1)}%`}function te({account:t,blockExplorerUrl:s,nowSec:c,onManage:l,onApproveWallets:h,onUseForPublishing:d,onRemove:x,onRetry:n,onSwitchNetwork:p,view:o}){const{accountId:v,snapshot:u,notFound:C,classification:g,ownerIsPrimaryWallet:N}=t;if(C)return e.jsx("div",{className:"card v10-pca-card","data-state":"not-found","data-account":v,"data-testid":"pca-account-card",children:e.jsxs("div",{className:"card-body v10-pca-card-error",children:[e.jsxs("p",{children:["PCA #",v," no longer exists on-chain."]}),x&&e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>x(v),children:"Remove from tracked"})]})});if(!u)return e.jsx("div",{className:"card v10-pca-card","data-state":"error","data-account":v,"data-testid":"pca-account-card",children:e.jsxs("div",{className:"card-body v10-pca-card-error",children:[e.jsxs("p",{children:["Couldn’t load PCA #",v,"."]}),n&&e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>n(v),children:"Retry"})]})});const T=be(u.expiresAtTimestamp,c),S=s?`${s}/address/${u.owner}`:void 0,m=t.ownerMode??(N?"daemon":"external"),y=m==="wallet"&&!!t.walletWrongNetwork,k=Be(m,y),b=t.connectedWallet,R=m==="daemon"?void 0:m==="wallet"?y?"Wrong network - switch the connected wallet to this node's PCA network.":"Connected wallet will sign this owner action.":b?`Connected as ${b}; switch to ${u.owner} to manage PCA #${v}.`:`Connect owner wallet ${u.owner} to manage PCA #${v}.`,W=e.jsxs("div",{className:"v10-pca-card-title",children:[e.jsxs("span",{className:"v10-pca-card-id",children:["PCA #",v]}),e.jsxs("span",{className:"badge badge-info v10-pca-card-discount",children:["◉ ",re(u.discountBps)," discount"]}),m==="wallet"&&e.jsx("span",{className:"badge badge-info",children:"✎ wallet-managed"}),m==="external"&&e.jsx("span",{className:"badge badge-warn",children:"tracked external"}),e.jsx("span",{className:"v10-pca-card-spacer"}),t.health&&e.jsx(Oe,{state:t.health})]}),A=e.jsxs("div",{className:"v10-pca-card-owner",children:[e.jsx("span",{className:"v10-pca-card-owner-lbl",children:"Owner"}),e.jsx(q,{address:u.owner,trailing:S?e.jsx("a",{className:"v10-pca-card-explorer",href:S,target:"_blank",rel:"noreferrer","aria-label":`View owner ${u.owner} on the block explorer`,children:"↗"}):void 0})]}),L=m==="daemon"?"Daemon-managed: owner actions use this node’s primary operational wallet.":m==="wallet"?"Wallet-managed: owner actions are signed by the connected wallet.":b?`Read-only here: connected as ${b}; switch to the owner wallet to manage.`:"Read-only here: connect the owner wallet to manage this PCA.";if(o==="coverage"?!1:o==="owner"?!0:g==="owned"||m==="wallet"||m==="external"&&t.approvedCount===0){const Y=t.approvedCount>0,$=t.probesInconclusive;return e.jsx("div",{className:"card v10-pca-card","data-state":"owned","data-owner-mode":m,"data-account":v,"data-testid":"pca-account-card",children:e.jsxs("div",{className:"card-body",children:[W,e.jsx(fe,{items:[{id:"committed",label:"Committed",value:`${ne(u.committedTRACTrac)} TRAC`},{id:"buffer",label:"Top-up buffer",value:`${ne(u.topUpBufferTrac)} TRAC`},{id:"per-epoch",label:"Per-epoch allowance",value:`${Ce(u.baseEpochAllowance)} TRAC`},{id:"wallets",label:"Publishing wallets",value:`${u.agentCount} / 100`}]}),A,m==="daemon"?e.jsxs("p",{className:"v10-pca-card-owner-note",children:["This is the node’s operational wallet — who ",e.jsx("strong",{children:"signs"}),", not who’s covered."]}):e.jsx("p",{className:"v10-pca-card-owner-note",children:L}),y&&e.jsxs("p",{className:"v10-pca-card-warn",role:"alert",children:["Wrong network. Reads still work, but wallet-owner writes are disabled until the wallet is switched."," ",p&&e.jsx("button",{type:"button",className:"v10-pca-inline-btn",onClick:p,children:"Switch network"})]}),m==="external"&&e.jsx("p",{className:"v10-pca-card-warn",children:b?`Connected as ${b} - switch to ${u.owner} to manage PCA #${v}.`:`Connect ${u.owner} to manage PCA #${v}.`}),$?e.jsx("p",{className:"v10-pca-card-warn",children:"⚠ Couldn’t verify which of this node’s wallets are approved — retry. Until then, whether this account discounts your publishes is unconfirmed."}):Y?null:e.jsx("p",{className:"v10-pca-card-warn",children:"⚠ 0 of this node’s wallets are approved here — it discounts nothing yet. Approve this node’s operational wallets to start saving."}),e.jsxs("p",{className:"v10-pca-card-meta",children:[T,e.jsx("span",{className:"v10-pca-card-meta-sep",children:" · "}),e.jsxs("span",{title:`Expiry epoch ${u.expiresAtEpoch}`,children:["epoch ",u.expiresAtEpoch," ⓘ"]})]}),e.jsxs("div",{className:"v10-pca-card-actions",children:[l&&e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:()=>l(v),children:m==="external"?"View details":"Manage"}),m==="external"?x&&e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>x(v),children:"Stop tracking"}):e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>h==null?void 0:h(v),disabled:!k||!h,title:R,children:"Approve wallets"})]})]})})}const U=t.walletCount>0&&t.approvedCount===t.walletCount,B=t.probesInconclusive;return e.jsx("div",{className:"card v10-pca-card","data-state":"approved","data-account":v,"data-testid":"pca-account-card",children:e.jsxs("div",{className:"card-body",children:[e.jsxs("div",{className:"v10-pca-card-title",children:[e.jsxs("span",{className:"v10-pca-card-id",children:["PCA #",v]}),e.jsx("span",{className:"v10-pca-card-sponsor",children:"(approved for this node)"}),e.jsxs("span",{className:"badge badge-info v10-pca-card-discount",children:["◉ ",re(u.discountBps)]}),e.jsx("span",{className:"v10-pca-card-spacer"}),B?e.jsx("span",{className:"badge badge-warn",children:"⚠ couldn’t verify approvals"}):!U&&t.walletCount>0?e.jsxs("span",{className:"badge badge-warn",children:["⚠ ",t.approvedCount," of ",t.walletCount," wallets approved"]}):null]}),A,e.jsxs("p",{className:"v10-pca-card-meta",children:[T,e.jsx("span",{className:"v10-pca-card-meta-sep",children:" · "}),e.jsxs("span",{title:`Expiry epoch ${u.expiresAtEpoch}`,children:["epoch ",u.expiresAtEpoch," ⓘ"]})]}),e.jsx("p",{className:"v10-pca-card-summary",children:B?"Approval coverage could not be fully verified.":`${t.approvedCount} of ${t.walletCount} node publishing wallet${t.walletCount===1?"":"s"} approved.`}),B?e.jsx("p",{className:"v10-pca-card-warn",children:"Couldn’t verify which wallets are approved — retry."}):!U&&t.walletCount>0?e.jsx("p",{className:"v10-pca-card-warn",children:"Publishes from the un-approved wallet(s) will quietly pay the direct cost."}):null,e.jsxs("div",{className:"v10-pca-card-actions",children:[l&&e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:()=>l(v),children:"View details"}),d&&e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:()=>d(v),children:"Use for publishing"})]})]})})}const Ke={84532:"https://www.alchemy.com/faucets/base-sepolia",11155111:"https://www.alchemy.com/faucets/ethereum-sepolia",10200:"https://faucet.chiadochain.net/"};function Qe(t){if(t==null)return;const s=String(t),c=s.includes(":")?s.split(":").pop():s;return Ke[c]}function Xe(t){switch(t.outcome){case"covers":return{text:"approved",tone:"success"};case"uncovered":return{text:"approved, but that PCA is expired, swept, or out of budget - publishes will not get the discount",tone:"warn"};case"unregistered":return{text:"not approved - ask the PCA owner to approve it",tone:"danger"};case"inconclusive":return{text:"unknown",tone:"neutral"}}}function Ze({onClose:t}){const{data:s,loading:c,error:l,refresh:h}=ee(pe,[],0),d=(s==null?void 0:s.wallets)??[],x=(s==null?void 0:s.balances)??[],n=typeof(s==null?void 0:s.error)=="string"&&s.error.length>0?s.error:null,p=l||n,o=(s==null?void 0:s.chainId)??null,v=je(o),u=Ne(o)?Qe(o):void 0,C=_(r=>r.trackAccount),{copied:g,copy:N}=Fe(),T=d.join(","),{data:S}=ee(async()=>{const r=(s==null?void 0:s.wallets)??[];if(r.length===0)return[];const w=await Promise.all(r.map(j=>ue(j).then(f=>f.accountId).catch(()=>null)));return Array.from(new Set(w.filter(j=>j!=null)))},[T],0),[m,y]=i.useState(""),[k,b]=i.useState(!1),[R,W]=i.useState(null),[A,L]=i.useState(null),V=r=>{var w;return(w=x.find(j=>{var f;return((f=j.address)==null?void 0:f.toLowerCase())===r.toLowerCase()}))==null?void 0:w.eth},U=r=>{const w=V(r);return w!=null&&Number(w)>0},B=async()=>{var w;const r=m.trim();if(!/^\d+$/.test(r)){W("Enter the numeric PCA ID the owner gave you.");return}b(!0),W(null);try{const j=await Promise.all(d.map(f=>ie(r,f,{extended:!0}).then(M=>({wallet:f,coverage:Ae(M)})).catch(()=>({wallet:f,coverage:{outcome:"inconclusive",registered:null,adapterUnsupported:!1}}))));if(j.length>0&&j.every(f=>f.coverage.outcome==="inconclusive")){const f=j.every(M=>M.coverage.outcome==="inconclusive"&&M.coverage.adapterUnsupported);W(f?"PCA approval isn’t verifiable on this chain’s adapter — not supported here. You can still publish without a discount.":`Couldn’t check approval on PCA #${r} right now — the chain lookup failed. Retry.`),L(null);return}j.some(f=>f.coverage.registered===!0)&&C(r),L({accountId:r,rows:j})}catch(j){W(((w=Pe(j,{accountId:r}))==null?void 0:w.message)??"Couldn’t check approval.")}finally{b(!1)}},Y=(A==null?void 0:A.rows.filter(r=>r.coverage.registered===!0).length)??0,$=!!A&&A.rows.some(r=>r.coverage.outcome==="covers"&&U(r.wallet));return e.jsxs(De,{onClose:t,testId:"pca-get-sponsored",title:"Get added to a PCA",subtitle:"Share this node's operational publishing wallets with the PCA owner. They approve them; this node still pays its own gas.",children:[e.jsxs("div",{className:"v10-modal-body v10-pca-get-added-body",children:[e.jsxs("section",{className:"v10-pca-detail-section",children:[e.jsx("h3",{className:"v10-pca-detail-section-title",children:"Your operational wallets (signers / msg.sender)"}),e.jsx("div",{className:"v10-pca-detail-agentlist",children:c&&!s?e.jsx("p",{className:"v10-pca-handshake-empty",role:"status",children:"Loading your wallets…"}):p&&d.length===0?e.jsxs("p",{className:"v10-modal-error",role:"alert",children:["Couldn’t load your wallets."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>h(),children:"Retry"})]}):d.length===0?e.jsx("p",{className:"v10-pca-handshake-empty",children:"No operational wallets detected on this node."}):d.map(r=>{const w=V(r),j=U(r);return e.jsx(q,{address:r,gas:w!=null?e.jsxs("span",{title:ke(w),children:["gas ",ye(w)," ",v," ",j?"✓":"⚠ fund to publish"]}):void 0},r)})}),d.length>0&&e.jsx("button",{type:"button",className:"v10-pca-handshake-copyall",onClick:()=>N(d.join(`
2
+ `)),"aria-label":g?"Copied all wallets":"Copy all wallet addresses",children:g?"Copied":`Copy all ${d.length}`}),e.jsxs("p",{className:"v10-pca-detail-hint",children:["Share ",e.jsx("strong",{children:"all"})," wallets (the node rotates its signer per publish) or pin to one. Share the exact address - a typo can be approved by the PCA owner but never match your real signer."]})]}),e.jsxs("div",{className:"v10-modal-warning",children:["⚠ Gas is always on you. The PCA covers the TRAC publishing fee — never your gas. Fund each wallet with native ",v,".",u?e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:u,target:"_blank",rel:"noreferrer",children:"Open faucet ↗"})," (testnet only)"]}):e.jsxs(e.Fragment,{children:[" ","Fund with native ",v," from your wallet."]})]}),e.jsxs("section",{className:"v10-pca-detail-section",children:[e.jsx("h3",{className:"v10-pca-detail-section-title",children:"Can't find it automatically?"}),e.jsx("p",{className:"v10-pca-detail-hint",children:"If the PCA owner gives you an account id, check it here to track whether this node's wallets are covered."}),S&&S.length>0&&e.jsxs("div",{className:"v10-pca-discovered-check",role:"status","data-testid":"pca-sponsor-discovered",children:["◉ We found your wallet(s) already approved on ",S.map(r=>`PCA #${r}`).join(", "),"."," ",e.jsxs("button",{type:"button",className:"v10-pca-card-btn compact",onClick:()=>y(S[0]),children:["Check PCA #",S[0]]})]}),e.jsxs("div",{className:"v10-pca-detail-form",children:[e.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:r=>y(r.target.value),placeholder:"PCA ID from owner (e.g. 7)","aria-label":"PCA ID from owner"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:B,disabled:k,children:k?"Checking…":"Check approval"})]}),R&&e.jsx("p",{className:"v10-modal-error",role:"alert",children:R}),A&&e.jsxs("div",{className:"v10-pca-approve-results",role:"status","aria-live":"polite",children:[e.jsxs("p",{className:"v10-pca-approve-summary",children:["Approved on PCA #",A.accountId,": ",Y," of ",A.rows.length," wallets ✓"]}),A.rows.map(r=>{const w=Xe(r.coverage);return e.jsx(q,{address:r.wallet,status:w.text,statusTone:w.tone},r.wallet)})]})]}),$&&e.jsxs("div",{className:"v10-pca-create-success",role:"status",children:["Ready: at least 1 wallet is approved and gas-funded - this node can publish under PCA #",A.accountId,"."," ","Publish from any context graph — the discount applies automatically to your approved wallets."]})]}),e.jsx("div",{className:"v10-modal-footer",children:e.jsx("button",{type:"button",className:"v10-modal-btn",onClick:t,children:"Close"})})]})}function Je(){const t=Ie(a=>a.nodeStatus),s=(t==null?void 0:t.nodeRole)==="core"||(t==null?void 0:t.nodeRole)==="edge"?t.nodeRole:void 0,c=(t==null?void 0:t.blockExplorerUrl)??null,l=Se(a=>a.openTab),h=_(a=>a.trackAccount),d=_(a=>a.untrackAccount),x=_(a=>a.setScope),n=D(a=>a.setBootstrap),p=D(a=>a.initWallet);D(a=>a.bootstrap);const o=D(a=>a.address),v=D(a=>Ee(a)),u=D(a=>a.switchToExpectedChain),[C,g]=i.useState({status:"idle",error:null}),N=He(),[T,S]=i.useState(0),m=Te(3e4,N.ids),{accounts:y,loading:k,refresh:b,walletsInconclusive:R}=m,W=m.wallets[0];i.useEffect(()=>{let a=!1;async function E(){g({status:"loading",error:null});try{const I=await Re();if(a)return;x(We(I)),n(I),p(),g({status:"ready",error:null})}catch(I){if(a)return;g({status:"error",error:(I==null?void 0:I.message)??"Could not bootstrap wallet contract reads."}),p()}}return E(),()=>{a=!0}},[T,p,x,n]);const{untracked:A,ownedError:L,agentError:V,refresh:U}=qe(),B=L||V,[Y,$]=i.useState(!1),[r,w]=i.useState(null),[j,f]=i.useState(!1),[M,se]=i.useState(null),P=i.useMemo(()=>y.map(a=>{var I;const E=Ue({owner:(I=a.snapshot)==null?void 0:I.owner,primaryWallet:W,connectedWallet:o,walletWrongNetwork:v});return{...a,ownerMode:E.mode,primaryWallet:W,connectedWallet:o,walletWrongNetwork:E.mode==="wallet"&&E.wrongNetwork}}),[y,o,W,v]);i.useEffect(()=>{!M||k||P.some(a=>a.accountId===M)&&se(null)},[P,k,M]);const H=i.useMemo(()=>P.filter(a=>a.ownerMode==="daemon"),[P]),K=i.useMemo(()=>P.filter(a=>a.ownerMode==="wallet"),[P]),Q=i.useMemo(()=>P.filter(a=>a.ownerMode==="external"&&a.snapshot&&a.approvedCount===0),[P]),X=i.useMemo(()=>P.filter(a=>a.approvedCount>0||!a.snapshot&&!a.notFound),[P]),G=a=>l({id:`conviction:${a}`,label:`PCA #${a}`,closable:!0}),he=i.useMemo(()=>[...H,...K],[H,K]),Z=i.useMemo(()=>m.wallets.map(a=>{const E=P.find(O=>O.snapshot&&ce(O.snapshot)&&O.walletProbes.some(F=>J(F.wallet,a)&&F.registered===!0));if(E!=null&&E.snapshot)return{wallet:a,status:`covered by PCA #${E.accountId}`,tone:"success"};const I=P.find(O=>O.snapshot&&!ce(O.snapshot)&&O.walletProbes.some(F=>J(F.wallet,a)&&F.registered===!0));return I!=null&&I.snapshot?{wallet:a,status:`approved on inactive PCA #${I.accountId}`,tone:"warn"}:R||P.some(O=>O.walletProbes.some(F=>J(F.wallet,a)&&F.registered==null))?{wallet:a,status:"unknown - retry wallet/PCA read",tone:"warn"}:k&&y.length===0?{wallet:a,status:"checking",tone:"neutral"}:{wallet:a,status:"direct cost",tone:"danger"}}),[y.length,P,k,m.wallets,R]),ve=Z.some(a=>a.tone==="success"),me=i.useCallback(()=>S(a=>a+1),[]),z=i.useCallback(()=>{u()},[u]),we=i.useCallback(a=>{se(a),h(a)},[h]);return e.jsxs("div",{className:"v10-pca-overview","data-testid":"pca-landing",children:[e.jsxs("header",{className:"v10-pca-overview-head",children:[e.jsxs("div",{className:"v10-pca-overview-titlerow",children:[e.jsx("h2",{className:"v10-pca-overview-title",children:"Publisher Conviction"}),s&&e.jsxs("span",{className:"badge v10-pca-role-chip",children:["Node role: ",s]})]}),e.jsx("p",{className:"v10-pca-overview-explainer",children:s==="edge"?"Publisher Conviction Accounts let publishers dedicate TRAC spend in advance and receive a publishing discount by tier: 0%, 10%, 20%, 30%, 40%, 50%, or 75%, based on the committed amount. Nodes can create their own PCA or get added to an existing PCA by sharing operational publishing wallets with the PCA owner. You still pay gas; the PCA covers only the TRAC publishing fee for approved wallets.":"A Publisher Conviction Account (PCA) lets you lock TRAC up front and approve publishing wallets to publish at a discount. The discount applies to the wallet that signs the publish (on-chain msg.sender), not a peerId, admin wallet, or author identity."})]}),e.jsxs("section",{className:"v10-pca-section v10-pca-coverage-summary","data-testid":"pca-coverage-summary",children:[e.jsxs("div",{className:"v10-pca-section-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"v10-pca-section-title",children:"This node's publishing wallet coverage"}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"The discount follows the operational wallet that signs a publish."})]}),e.jsxs("div",{className:"v10-pca-overview-cta-group",children:[e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:()=>f(!0),children:"Get added to a PCA"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-create-btn",onClick:()=>$(!0),children:"+ Create PCA"})]})]}),Z.length>0?e.jsx("div",{className:"v10-pca-wallet-list",children:Z.map(a=>e.jsx(q,{address:a.wallet,status:a.status,statusTone:a.tone},a.wallet))}):R?e.jsxs("p",{className:"v10-pca-overview-caveat",role:"status",children:["Couldn't read this node's wallets, so coverage can't be confirmed."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>b(),children:"Retry"})]}):e.jsx("p",{className:"v10-pca-overview-caveat",children:"No operational publishing wallets were reported by this node."}),!ve&&!k&&!R&&!B&&e.jsx("p",{className:"v10-pca-inline-status",role:"status",children:"No PCA discount is active for this node yet. Publishes from direct-cost wallets use the signing wallet."}),!k&&X.length>0&&e.jsxs("div",{className:"v10-pca-linked-pcas","data-testid":"pca-approved-section",children:[e.jsxs("div",{className:"v10-pca-account-group-head",children:[e.jsx("h3",{className:"v10-pca-account-group-title",children:"PCAs linked to this node"}),e.jsx("span",{className:"v10-pca-account-group-count",children:X.length})]}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"Account summaries for PCAs that approve at least one of this node's publishing wallets. Wallet coverage above is the source of truth for publish discounts."}),e.jsx("div",{className:"v10-pca-card-grid v10-pca-card-grid-compact",children:X.map(a=>e.jsx(te,{account:a,view:"coverage",blockExplorerUrl:c,onManage:G,onApproveWallets:E=>w({accountId:E,mode:"sponsor"}),onRemove:d,onRetry:()=>b(),onSwitchNetwork:z},`approved-${a.accountId}`))})]})]}),k&&y.length===0?e.jsxs("div",{className:"v10-pca-card-grid",children:[e.jsx("div",{className:"card v10-pca-card v10-pca-card-skeleton","aria-hidden":"true"}),e.jsx("div",{className:"card v10-pca-card v10-pca-card-skeleton","aria-hidden":"true"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"v10-pca-section","data-testid":"pca-owned-section",children:[e.jsxs("div",{className:"v10-pca-section-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"v10-pca-section-title",children:"Owned by me"}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"Connect an owner wallet to discover and manage wallet-owned PCAs. Node-owned PCAs use the daemon wallet."})]}),e.jsx("div",{className:"v10-pca-overview-cta-group",children:e.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-create-owned-btn",onClick:()=>$(!0),children:"+ Create PCA"})})]}),e.jsx("div",{className:"v10-pca-overview-wallet",children:e.jsx(Le,{className:"compact"})}),he.length>0?e.jsxs("div",{className:"v10-pca-owned-groups",children:[e.jsx(le,{title:"This node (hot wallet)",description:"Daemon-owned PCAs. Owner writes use the node daemon.",accounts:H,blockExplorerUrl:c,onManage:G,onApproveWallets:a=>w({accountId:a,mode:"sponsor"}),onRemove:d,onRetry:()=>b(),onSwitchNetwork:z}),e.jsx(le,{title:o?`${ae(o)} (connected)`:"Connected wallet",description:"Wallet-managed PCAs. Owner writes are signed by the connected wallet.",accounts:K,blockExplorerUrl:c,onManage:G,onApproveWallets:a=>w({accountId:a,mode:"sponsor"}),onRemove:d,onRetry:()=>b(),onSwitchNetwork:z})]}):R?null:e.jsx("p",{className:"v10-pca-inline-status",children:"No owned PCAs are tracked yet."})]}),e.jsxs("section",{className:"v10-pca-section","data-testid":"pca-tracked-external-section",children:[e.jsxs("div",{className:"v10-pca-account-group-head",children:[e.jsx("h3",{className:"v10-pca-section-title",children:"Tracked external accounts"}),e.jsx("span",{className:"v10-pca-account-group-count",children:Q.length})]}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"Read-only PCA records you track manually. Connect the owner wallet to manage one."}),Q.length>0?e.jsx("div",{className:"v10-pca-card-grid",children:Q.map(a=>e.jsx(te,{account:a,view:"owner",blockExplorerUrl:c,onManage:G,onRemove:d,onRetry:()=>b(),onSwitchNetwork:z},`external-${a.accountId}`))}):e.jsx("p",{className:"v10-pca-inline-status",children:"No external PCAs are tracked manually."}),e.jsx(aa,{onTrack:we})]})]}),M&&e.jsxs("p",{className:"v10-pca-track-status",role:"status","data-testid":"pca-track-status",children:["Checking PCA #",M,". It will appear here when the chain read returns."]}),B&&e.jsx("section",{className:"v10-pca-discovered","data-testid":"pca-discovered-error",role:"status",children:e.jsxs("p",{className:"v10-pca-overview-caveat",children:["Couldn't verify this node's Publisher Conviction Accounts; approved PCA coverage may still exist."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>U(),children:"Retry"})]})}),C.status==="error"&&e.jsx("section",{className:"v10-pca-discovered","data-testid":"pca-wallet-bootstrap-error",role:"status",children:e.jsxs("p",{className:"v10-pca-overview-caveat",children:["Note: Couldn't load wallet contract bootstrap, so connected-wallet PCA discovery is paused."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:me,children:"Retry"})]})}),N.error&&e.jsx("section",{className:"v10-pca-discovered","data-testid":"pca-wallet-discovery-error",role:"status",children:e.jsxs("p",{className:"v10-pca-overview-caveat",children:["Note: Couldn't read PCAs owned by the connected wallet. Existing tracked PCAs are still shown."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:N.refresh,children:"Retry"})]})}),N.loading&&o&&e.jsxs("p",{className:"v10-pca-overview-caveat",role:"status",children:["Reading PCAs owned by ",ae(o),"..."]}),e.jsx(ea,{items:A,onTrack:h,onManage:G}),Y&&e.jsx(Ge,{onClose:()=>{$(!1),b()},onApproveOwnWallets:a=>{$(!1),w({accountId:a,mode:"self",selfCoverage:!0})},onManage:a=>{$(!1),G(a)},onGetSponsored:()=>{$(!1),f(!0)}}),r&&e.jsx(_e,{accountId:r.accountId,initialMode:r.mode,selfCoverage:r.selfCoverage,onClose:()=>{w(null),b()}}),j&&e.jsx(Ze,{onClose:()=>{f(!1),b()}})]})}function ea({items:t,onTrack:s,onManage:c}){return t.length===0?null:e.jsxs("section",{className:"v10-pca-discovered","data-testid":"pca-discovered-strip",children:[e.jsx("h3",{className:"v10-pca-discovered-title",children:"Discovered - not tracked here"}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"Found on-chain for this node's wallets or the connected wallet. Track to show them in the grid above."}),t.map(l=>{var d;const h=(d=l.basics)==null?void 0:d.discountBps;return e.jsxs("div",{className:"v10-pca-discovered-row","data-testid":"pca-discovered-row",children:[e.jsxs("span",{className:"v10-pca-discovered-label",children:[e.jsxs("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>c(l.accountId),children:["PCA #",l.accountId]})," ","-"," ",l.relation==="agent"?`your wallet ${l.agentWallet?ae(l.agentWallet):""} is approved here`:l.relation==="both"?"you own this; your wallet is approved here":"you own this account",(l.relation==="agent"||l.relation==="both")&&typeof h=="number"&&h>0&&e.jsxs("span",{className:"badge badge-info",children:[" ",(h/100).toFixed(h%100===0?0:1),"%"]})]}),e.jsx("button",{type:"button",className:"v10-pca-card-btn primary","data-testid":"pca-discovered-track",onClick:()=>s(l.accountId),children:"Track"})]},l.accountId)})]})}function le({title:t,description:s,accounts:c,blockExplorerUrl:l,onManage:h,onApproveWallets:d,onRemove:x,onRetry:n,onSwitchNetwork:p}){return c.length===0?null:e.jsxs("section",{className:"v10-pca-account-group",children:[e.jsxs("div",{className:"v10-pca-account-group-head",children:[e.jsx("h3",{className:"v10-pca-account-group-title",children:t}),e.jsx("span",{className:"v10-pca-account-group-count",children:c.length})]}),e.jsx("p",{className:"v10-pca-overview-caveat",children:s}),e.jsx("div",{className:"v10-pca-card-grid",children:c.map(o=>e.jsx(te,{account:o,view:"owner",blockExplorerUrl:l,onManage:h,onApproveWallets:d,onRemove:x,onRetry:n,onSwitchNetwork:p},o.accountId))})]})}function aa({onTrack:t}){const[s,c]=i.useState(!1),[l,h]=i.useState(""),[d,x]=i.useState(null),n=i.useId(),p=()=>{const o=l.trim();if(!/^\d+$/.test(o)){x("Enter a numeric account id.");return}t(o),h(""),x(null),c(!1)};return e.jsxs("div",{className:"v10-pca-track",children:[e.jsx("button",{type:"button",className:"v10-pca-track-toggle","data-testid":"pca-track-toggle","aria-expanded":s,"aria-controls":n,onClick:()=>c(o=>!o),children:"Track PCA by ID"}),s&&e.jsxs("div",{id:n,className:"v10-pca-track-panel",children:[e.jsx("input",{type:"text",className:"v10-form-input","data-testid":"pca-track-input",value:l,onChange:o=>h(o.target.value),placeholder:"Account id (e.g. 7)","aria-label":"Account id to track",onKeyDown:o=>{o.key==="Enter"&&p()}}),e.jsx("button",{type:"button",className:"v10-pca-card-btn primary","data-testid":"pca-track-submit",onClick:p,children:"Track"}),d&&e.jsx("p",{className:"v10-pca-crux-error",role:"alert",children:d})]})]})}const ta="https://docs.origintrail.io/";function oa(){const{status:t,recheck:s}=Ve();return e.jsx("div",{"data-testid":"pca-view",children:t==="loading"?e.jsx("div",{className:"lazy-spinner",children:"Loading publisher conviction..."}):t==="unavailable"?e.jsx("div",{className:"v10-pca-unavailable","data-testid":"pca-unavailable",children:e.jsx($e,{tone:"neutral",title:"Publisher conviction isn't available on this network",description:"This deployment's chain adapter doesn't support Publisher Conviction Accounts yet.",actions:[{label:"Recheck",onClick:s,variant:"primary",testId:"pca-recheck-btn"},{label:"Learn more",onClick:()=>window.open(ta,"_blank","noopener")}]})}):e.jsx(Je,{})})}export{oa as PublishingConvictionPage};
@@ -0,0 +1 @@
1
+ import{aH as E,aM as $,aG as B,ad as e,aD as j,ap as i,ar as P,X as W,Y as I,M as L,Q as M,O as D,R as N,ay as C,t as O,K as U,ax as T,U as H}from"./index-DGpnb_b1.js";function F(s,r){const t=(s??"").trim();if(!t)return"TRAC";const n=(r??"").includes(":")?(r??"").split(":")[1]:r??"";return n==="84532"||n==="11155111"||n==="31337"||n==="10200"||n==="20430"?/test/i.test(t)?t:`${t} (testnet)`:t}function w(s,r=2){if(s==null)return"—";let t;if(typeof s=="number")t=s;else{const n=String(s).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n))return"—";t=Number(n)}return Number.isFinite(t)?t.toFixed(r):"—"}function A(s){if(w(s)!=="—")return`Exact: ${s}`}const k="************",_=/[A-Za-z0-9_-]{16,}/g;function q(s){if(!s)return"";let r;try{r=new URL(s)}catch{return s.replace(_,k)}(r.username||r.password)&&(r.username="",r.password="");const t=r.pathname.split("/").map(n=>n.length<16?n:/^[A-Za-z0-9_-]+$/.test(n)?k:n);if(r.pathname=t.join("/"),r.search){const n=new URLSearchParams(r.search);for(const a of Array.from(n.keys()))/key|token|secret|auth/i.test(a)&&n.set(a,k);r.search=n.toString()}return r.toString()}function K(s){if(s==null)return"—";const r=s/100;return`${r%1===0?r.toFixed(0):r.toFixed(1)}%`}function Z(){E();const s=$(u=>u.openTab),{accounts:r,covered:t,bestCoveringDiscountBps:n,walletsInconclusive:a}=B(),l=r.length;return e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Publisher Conviction"})}),e.jsxs("div",{className:"card-body",children:[l===0?e.jsx("p",{className:"v10-pca-settings-line",children:"No tracked Publisher Conviction Account on this node."}):t?e.jsxs("p",{className:"v10-pca-settings-line",children:["This node’s approved publishing wallets use a ",e.jsx("strong",{children:K(n)})," discount."]}):a?e.jsx("p",{className:"v10-pca-settings-line",role:"status",children:"Couldn’t verify this node’s wallets — retry."}):e.jsxs("p",{className:"v10-pca-settings-line",children:["Tracking ",l," account",l===1?"":"s",", but none currently covers this node’s publishes."]}),e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>s({id:"conviction",label:"Publisher Conviction",closable:!0}),children:"Manage publisher conviction ->"})]})]})}function p({label:s,value:r,mono:t=!1}){return e.jsxs("div",{style:{marginBottom:14},children:[e.jsx("div",{className:"settings-field-label",children:s}),e.jsx("div",{className:`settings-field-value${t?" mono":""}`,children:r})]})}function G({rpcUrl:s}){const[r,t]=i.useState(!1),n=r?s:q(s);return e.jsxs("div",{style:{marginBottom:14},children:[e.jsxs("div",{className:"settings-field-label",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"RPC"}),e.jsx("button",{type:"button",onClick:()=>t(a=>!a),style:{background:"none",border:"1px solid var(--border)",color:"var(--text-dim)",cursor:"pointer",fontSize:9,fontWeight:600,padding:"1px 6px",borderRadius:4},"aria-label":r?"Redact RPC URL":"Reveal RPC URL",title:r?"Hide the path-token (recommended for screen-shares)":"Show full URL — careful, may contain a tenant secret",children:r?"Redact":"Reveal"})]}),e.jsx("div",{className:"settings-field-value mono",style:{wordBreak:"break-all"},children:n})]})}function Q(){const{data:s}=j(D,[],6e4),[r,t]=i.useState(!1),[n,a]=i.useState(!1),[l,u]=i.useState(null),[m,o]=i.useState(!1),h=N.useRef(null),f=N.useRef(null);i.useEffect(()=>{s!=null&&t(s.enabled)},[s]);const g=i.useCallback(()=>{n||(u(null),r?(t(!1),a(!0),C(!1).catch(()=>{t(!0),u("Couldn’t update telemetry — try again.")}).finally(()=>a(!1))):o(!0))},[r,n]),y=i.useCallback(async()=>{var c;o(!1),u(null),t(!0),a(!0);try{await C(!0)}catch{t(!1),u("Couldn’t update telemetry — try again.")}finally{a(!1),(c=f.current)==null||c.focus()}},[]);return i.useEffect(()=>{var v;if(!m)return;const c=(v=h.current)==null?void 0:v.querySelector("button");c==null||c.focus();const d=S=>{var b;S.key==="Escape"&&(o(!1),(b=f.current)==null||b.focus())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[m]),e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Network Telemetry"})}),e.jsxs("div",{className:"card-body",children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:16,lineHeight:1.6},children:"Local metrics are stored in SQLite and displayed in the Observability page."}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"10px 0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600},children:"Share telemetry with the network"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2,lineHeight:1.5},children:"When enabled, metrics and logs are streamed to the OriginTrail network dashboard for network-wide diagnostics."})]}),e.jsx("button",{ref:f,type:"button",role:"switch","aria-checked":r,"aria-busy":n,"aria-disabled":n,"aria-label":"Share telemetry with the network",onClick:g,style:{width:38,height:22,borderRadius:11,border:"none",flexShrink:0,background:r?"var(--green)":"var(--border)",transition:"background .2s",position:"relative",marginLeft:16,cursor:n?"wait":"pointer",opacity:n?.6:1},children:e.jsx("span",{style:{position:"absolute",top:3,left:r?19:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left .2s",display:"block"}})})]}),e.jsx("div",{"aria-live":"polite",children:l&&e.jsx("div",{style:{fontSize:11,color:"var(--red)",marginTop:4},children:l})})]}),m&&e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"rgba(0,0,0,.55)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":"Enable Telemetry Streaming?",style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:"24px 28px",maxWidth:440,width:"90%",boxShadow:"0 8px 32px rgba(0,0,0,.3)"},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,marginBottom:16},children:"Enable Telemetry Streaming?"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.7,marginBottom:12},children:"When enabled, the following data is streamed to the OriginTrail team:"}),e.jsxs("ul",{style:{fontSize:12,color:"var(--text)",lineHeight:1.8,margin:"0 0 14px 18px",padding:0},children:[e.jsx("li",{children:"Operation logs (publish, query, sync, gossip events)"}),e.jsx("li",{children:"Performance metrics (durations, throughput, error rates)"}),e.jsx("li",{children:"Node identity (peer ID, node name, network)"})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.7,marginBottom:12},children:["The following data is ",e.jsx("strong",{style:{color:"var(--text)"},children:"NEVER"})," shared via telemetry:"]}),e.jsxs("ul",{style:{fontSize:12,color:"var(--text)",lineHeight:1.8,margin:"0 0 16px 18px",padding:0},children:[e.jsx("li",{children:"Private keys or wallet credentials"}),e.jsx("li",{children:"Authentication tokens or API keys"}),e.jsx("li",{children:"Private triple content or personal data"}),e.jsx("li",{children:"File system paths or environment variables"})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:20,lineHeight:1.5},children:"You can disable streaming at any time from this page."}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[e.jsx("button",{type:"button",onClick:()=>{var c;o(!1),(c=f.current)==null||c.focus()},style:{padding:"7px 18px",borderRadius:7,fontSize:12,fontWeight:600,cursor:"pointer",border:"1px solid var(--border)",background:"var(--surface)",color:"var(--text-muted)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:y,style:{padding:"7px 18px",borderRadius:7,fontSize:12,fontWeight:700,cursor:"pointer",border:"1px solid rgba(74,222,128,.4)",background:"rgba(74,222,128,.1)",color:"var(--green)"},children:"Enable Streaming"})]})]})})]})}function Y(){const{data:s}=j(O,[],3e4),{data:r}=j(U,[],6e4),[t,n]=i.useState(90),[a,l]=i.useState(!1),[u,m]=i.useState(null),[o,h]=i.useState(null),f=N.useRef(null);i.useEffect(()=>{r!=null&&r.retentionDays&&n(r.retentionDays)},[r]),i.useEffect(()=>{var d;o!=null&&((d=f.current)==null||d.focus())},[o]);const g=i.useCallback(async()=>{if(o==null)return;const d=o;l(!1),m(null),h(null);try{await T(d),n(d),l(!0),setTimeout(()=>l(!1),2e3)}catch{m("Couldn’t save retention — try again.")}},[o]),y=i.useCallback(d=>{m(null),d<t?(l(!1),h(d)):(l(!1),h(null),T(d).then(()=>{n(d),l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>m("Couldn’t save retention — try again.")))},[t]),c=(s==null?void 0:s.store_bytes)??null;return e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Local Data Retention"})}),e.jsxs("div",{className:"card-body",children:[e.jsx("label",{htmlFor:"retention-select",className:"settings-field-label",style:{display:"block",marginBottom:5},children:"Keep local data for"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("select",{id:"retention-select",className:"input",value:o??t,onChange:d=>y(Number(d.target.value)),style:{width:160},children:[e.jsx("option",{value:7,children:"7 days"}),e.jsx("option",{value:30,children:"30 days"}),e.jsx("option",{value:90,children:"90 days"}),e.jsx("option",{value:180,children:"180 days"}),e.jsx("option",{value:365,children:"365 days"})]}),e.jsx("span",{"aria-live":"polite",children:a&&e.jsx("span",{style:{fontSize:10,color:"var(--green)",fontWeight:600},children:"Saved"})}),c!=null&&e.jsxs("span",{className:"mono",style:{fontSize:10,color:"var(--text-dim)"},children:["Store: ",H(c)]})]}),o!=null&&e.jsxs("div",{role:"group","aria-label":"Confirm retention reduction",style:{marginTop:8,padding:"10px 14px",borderRadius:8,background:"rgba(251,191,36,.06)",border:"1px solid rgba(251,191,36,.2)"},children:[e.jsxs("div",{style:{fontSize:11,color:"var(--amber)",fontWeight:600,marginBottom:4},children:["Reduce retention to ",o," days?"]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",lineHeight:1.5,marginBottom:8},children:["Operations, logs, and metrics older than ",o," days will be permanently deleted."]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{ref:f,type:"button",onClick:g,style:{padding:"5px 14px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",border:"1px solid rgba(251,191,36,.4)",background:"rgba(251,191,36,.1)",color:"var(--amber)"},children:"Prune & Save"}),e.jsx("button",{type:"button",onClick:()=>h(null),style:{padding:"5px 14px",borderRadius:6,fontSize:11,fontWeight:600,cursor:"pointer",border:"1px solid var(--border)",background:"var(--surface)",color:"var(--text-muted)"},children:"Cancel"})]})]}),o==null&&e.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",marginTop:4},children:"Operations, logs, and metric snapshots older than this are pruned automatically."}),e.jsx("div",{"aria-live":"polite",children:u&&e.jsx("div",{style:{fontSize:11,color:"var(--red)",marginTop:4},children:u})})]})]})}function V(s){const r=Math.floor(s/1e3);if(r<60)return`${r}s`;const t=Math.floor(r/60);if(t<60)return`${t}m ${r%60}s`;const n=Math.floor(t/60);return n<24?`${n}h ${t%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function X(s){return s.length<=12?s:`${s.slice(0,6)}…${s.slice(-4)}`}function J(s){if(!s)return"Unknown";const r=s.includes(":")?s.split(":")[1]:s;switch(r){case"84532":return"Base Sepolia (Testnet)";case"8453":return"Base (Mainnet)";case"1":return"Ethereum Mainnet";case"11155111":return"Sepolia (Testnet)";case"31337":return"Local (Hardhat)";default:return`Chain ${r}`}}function ne(){return e.jsxs("div",{className:"page-section",children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Settings"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4},children:"Node configuration and preferences"})]}),e.jsx(ee,{})]})}function ee(){var g,y,c,d,v,S,b,R;const{data:s}=j(L,[],3e4),{data:r}=j(M,[],6e4),t=s,n=r,[a,l]=i.useState(!1),[u,m]=i.useState(!1),o=(t==null?void 0:t.connectedPeers)??0,h=(t==null?void 0:t.peerId)!=null,f=i.useCallback(async()=>{if(!a){l(!0),setTimeout(()=>l(!1),5e3);return}m(!0);try{await P()}catch{m(!1),l(!1)}},[a]);return e.jsxs("div",{className:"settings-stack",children:[e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Node Identity"})}),e.jsxs("div",{className:"card-body",children:[e.jsx(p,{label:"Name",value:(t==null?void 0:t.name)??"—"}),e.jsx(p,{label:"Peer ID",value:(t==null?void 0:t.peerId)??"—",mono:!0}),e.jsx(p,{label:"Role",value:(t==null?void 0:t.nodeRole)??"—"}),e.jsx(p,{label:"Network",value:(t==null?void 0:t.networkName)??(t!=null&&t.networkId?`Network ${t.networkId}`:"—")}),e.jsx(p,{label:"Store",value:(t==null?void 0:t.storeBackend)??"—",mono:!0}),e.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,background:h?"var(--green-dim)":"rgba(248,113,113,.05)",border:`1px solid ${h?"rgba(74,222,128,.2)":"rgba(248,113,113,.2)"}`},children:[e.jsx("div",{className:"mono",style:{fontSize:10,color:h?"var(--green)":"var(--red)",fontWeight:700},children:h?"● ONLINE":"● OFFLINE"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},title:"Peers = unique remote nodes. Direct + Relayed counts are libp2p connections — a single peer can hold both a direct and a relayed link, so they sum to ≥ Peers, not exactly equal to it.",children:h?`${o} peer${o!==1?"s":""} · ${((g=t==null?void 0:t.connections)==null?void 0:g.direct)??0} direct, ${((y=t==null?void 0:t.connections)==null?void 0:y.relayed)??0} relayed link${(((c=t==null?void 0:t.connections)==null?void 0:c.relayed)??0)===1?"":"s"} · up ${V((t==null?void 0:t.uptimeMs)??0)}`:"Node is not responding"})]})]})]}),e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Blockchain Config"})}),e.jsxs("div",{className:"card-body",children:[e.jsx(p,{label:"Chain",value:J(n==null?void 0:n.chainId)}),((d=n==null?void 0:n.balances)==null?void 0:d.length)>0?n.balances.map((x,z)=>e.jsxs("div",{style:{marginBottom:10},children:[e.jsx(p,{label:n.balances.length>1?`Wallet ${z+1}`:"Operational Wallet",value:x.address,mono:!0}),e.jsxs("div",{style:{display:"flex",gap:16,marginTop:-6},children:[e.jsxs("span",{className:"mono",style:{fontSize:11,color:"var(--text-muted)"},title:I(x.eth),children:[W(x.eth)," ETH"]}),e.jsxs("span",{className:"mono",style:{fontSize:11,color:"var(--text-muted)"},title:A(x.trac),children:[w(x.trac)," ",F(x.symbol,n==null?void 0:n.chainId)]})]})]},x.address)):e.jsx(p,{label:"Operational Wallet",value:(v=n==null?void 0:n.wallets)!=null&&v[0]?X(n.wallets[0]):"—",mono:!0}),(n==null?void 0:n.rpcUrl)&&e.jsx(G,{rpcUrl:n.rpcUrl}),n!=null&&n.error?e.jsxs("div",{style:{padding:"8px 12px",borderRadius:8,background:"rgba(248,113,113,.05)",border:"1px solid rgba(248,113,113,.2)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--red)",marginBottom:2},children:"⚠ Error"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:n.error})]}):(S=n==null?void 0:n.chainId)!=null&&S.includes("84532")||(b=n==null?void 0:n.chainId)!=null&&b.includes("31337")||(R=n==null?void 0:n.chainId)!=null&&R.includes("11155111")?e.jsxs("div",{style:{padding:"8px 12px",borderRadius:8,background:"var(--amber-dim)",border:"1px solid rgba(251,191,36,.2)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--amber)",marginBottom:2},children:"⚠ Testnet Mode"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:"No real TRAC is spent. Perfect for development."})]}):null]})]}),e.jsx(Z,{}),e.jsx(Q,{}),e.jsx(Y,{}),e.jsxs("section",{className:"card",style:{borderColor:"rgba(248,113,113,.2)",background:"rgba(248,113,113,.03)"},children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",style:{color:"var(--red)"},children:"Danger Zone"})}),e.jsx("div",{className:"card-body",children:e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{onClick:f,disabled:u,style:{padding:"8px 16px",borderRadius:8,border:`1px solid ${a?"var(--red)":"rgba(251,191,36,.3)"}`,background:a?"rgba(248,113,113,.15)":"rgba(251,191,36,.07)",color:a?"var(--red)":"var(--amber)",fontSize:12,fontWeight:600,cursor:u?"not-allowed":"pointer",opacity:u?.5:1},children:u?"Shutting down…":a?"Confirm Shutdown":"Shutdown Node"}),e.jsx("span",{"aria-live":"polite",children:a&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Click again to confirm. The node process will terminate."})})]})})]})]})}export{ne as SettingsPage};
@@ -0,0 +1 @@
1
+ import{B as u,n as b,y as k,j as R,p as M,s as S,r as $,h as A,i as T,l as C,m as w,o as E,b as p,q as G}from"./ApproveWalletsModal-9w2edv7e.js";import"./index-DGpnb_b1.js";class D extends u{constructor({callbackSelector:a,cause:t,data:f,extraData:e,sender:l,urls:i}){var o;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(o=t.metaMessages)!=null&&o.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(n=>` ${b(n)}`)],` Sender: ${l}`,` Data: ${f}`,` Callback selector: ${a}`,` Extra data: ${e}`].flat(),name:"OffchainLookupError"})}}class j extends u{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${b(t)}`,`Response: ${k(a)}`],name:"OffchainLookupResponseMalformedError"})}}class B extends u{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const _="0x556f1830",P={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function F(c,{blockNumber:a,blockTag:t,data:f,requestOptions:e,to:l}){var s;const{args:i}=R({data:f,abi:[P]}),[o,n,d,m,y]=i,{ccipRead:h}=c,r=h&&typeof(h==null?void 0:h.request)=="function"?h.request:U;try{if(!M(l,o))throw new B({sender:o,to:l});const g=n.includes(S)?await $({data:d,ccipRequest:x=>r({...x,requestOptions:e})}):await r({data:d,requestOptions:e,sender:o,urls:n}),{data:L}=await A(c,{blockNumber:a,blockTag:t,data:T([m,C([{type:"bytes"},{type:"bytes"}],[g,y])]),requestOptions:e,to:l});return L}catch(g){throw(s=e==null?void 0:e.signal)!=null&&s.aborted?w(e.signal):E(g)?g:new D({callbackSelector:m,cause:g,data:f,extraData:y,sender:o,urls:n})}}async function U({data:c,requestOptions:a,sender:t,urls:f}){var l,i,o;let e=new Error("An unknown error occurred.");for(let n=0;n<f.length;n++){if((l=a==null?void 0:a.signal)!=null&&l.aborted)throw w(a.signal);const d=f[n],m=d.includes("{data}")?"GET":"POST",y=m==="POST"?{data:c,sender:t}:void 0,h=m==="POST"?{"Content-Type":"application/json"}:{};try{const r=await fetch(d.replace("{sender}",t.toLowerCase()).replace("{data}",c),{body:JSON.stringify(y),headers:h,method:m,...a!=null&&a.signal?{signal:a.signal}:{}});let s;if((i=r.headers.get("Content-Type"))!=null&&i.startsWith("application/json")?s=(await r.json()).data:s=await r.text(),!r.ok){e=new p({body:y,details:s!=null&&s.error?k(s.error):r.statusText,headers:r.headers,status:r.status,url:d});continue}if(!G(s)){e=new j({result:s,url:d});continue}return s}catch(r){if((o=a==null?void 0:a.signal)!=null&&o.aborted)throw w(a.signal);if(E(r))throw r;e=new p({body:y,details:r.message,url:d})}}throw e}export{U as ccipRequest,F as offchainLookup,P as offchainLookupAbiItem,_ as offchainLookupSignature};