@ffaerber/swarm-connect 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -19
- package/dist/components/SwarmConnectButton.d.ts +1 -1
- package/dist/components/SwarmConnectModal.d.ts +6 -2
- package/dist/components/atoms.d.ts +53 -0
- package/dist/components/steps.d.ts +35 -0
- package/dist/constants.d.ts +10 -20
- package/dist/hooks/useNodeWallet.d.ts +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/swarm-connect.js +1548 -1093
- package/dist/swarm-connect.umd.cjs +34 -17
- package/dist/theme.d.ts +11 -0
- package/dist/types.d.ts +42 -0
- package/package.json +5 -2
- package/dist/components/StepLabel.d.ts +0 -8
- package/dist/components/tabs/SwarmTab.d.ts +0 -11
- package/dist/components/tabs/WalletTab.d.ts +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(L,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("wagmi"),require("viem"),require("@tanstack/react-query")):typeof define=="function"&&define.amd?define(["exports","react","wagmi","viem","@tanstack/react-query"],m):(L=typeof globalThis<"u"?globalThis:L||self,m(L.SwarmConnect={},L.React,L.wagmi,L.viem,L.ReactQuery))})(this,function(L,m,O,_,Oe){"use strict";var me={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var ze;function yt(){if(ze)return ne;ze=1;var n=m,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function p(h,d,o){var u,v={},g=null,y=null;o!==void 0&&(g=""+o),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(y=d.ref);for(u in d)i.call(d,u)&&!l.hasOwnProperty(u)&&(v[u]=d[u]);if(h&&h.defaultProps)for(u in d=h.defaultProps,d)v[u]===void 0&&(v[u]=d[u]);return{$$typeof:r,type:h,key:g,ref:y,props:v,_owner:s.current}}return ne.Fragment=a,ne.jsx=p,ne.jsxs=p,ne}var re={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,24 +14,41 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Le;function wt(){return Le||(Le=1,process.env.NODE_ENV!=="production"&&function(){var n=m,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),T=Symbol.iterator,I="@@iterator";function z(e){if(e===null||typeof e!="object")return null;var c=T&&e[T]||e[I];return typeof c=="function"?c:null}var C=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(e){{for(var c=arguments.length,f=new Array(c>1?c-1:0),x=1;x<c;x++)f[x-1]=arguments[x];F("error",e,f)}}function F(e,c,f){{var x=C.ReactDebugCurrentFrame,S=x.getStackAddendum();S!==""&&(c+="%s",f=f.concat([S]));var E=f.map(function(w){return String(w)});E.unshift("Warning: "+c),Function.prototype.apply.call(console[e],console,E)}}var R=!1,j=!1,A=!1,N=!1,Q=!1,Y;Y=Symbol.for("react.module.reference");function Re(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===l||Q||e===s||e===o||e===u||N||e===y||R||j||A||typeof e=="object"&&e!==null&&(e.$$typeof===g||e.$$typeof===v||e.$$typeof===p||e.$$typeof===h||e.$$typeof===d||e.$$typeof===Y||e.getModuleId!==void 0))}function K(e,c,f){var x=e.displayName;if(x)return x;var S=c.displayName||c.name||"";return S!==""?f+"("+S+")":f}function he(e){return e.displayName||"Context"}function G(e){if(e==null)return null;if(typeof e.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case a:return"Portal";case l:return"Profiler";case s:return"StrictMode";case o:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var c=e;return he(c)+".Consumer";case p:var f=e;return he(f._context)+".Provider";case d:return K(e,e.render,"ForwardRef");case v:var x=e.displayName||null;return x!==null?x:G(e.type)||"Memo";case g:{var S=e,E=S._payload,w=S._init;try{return G(w(E))}catch{return null}}}return null}var M=Object.assign,le=0,Xe,qe,Qe,et,tt,nt,rt;function at(){}at.__reactDisabledLog=!0;function qt(){{if(le===0){Xe=console.log,qe=console.info,Qe=console.warn,et=console.error,tt=console.group,nt=console.groupCollapsed,rt=console.groupEnd;var e={configurable:!0,enumerable:!0,value:at,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}le++}}function Qt(){{if(le--,le===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:Xe}),info:M({},e,{value:qe}),warn:M({},e,{value:Qe}),error:M({},e,{value:et}),group:M({},e,{value:tt}),groupCollapsed:M({},e,{value:nt}),groupEnd:M({},e,{value:rt})})}le<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ee=C.ReactCurrentDispatcher,_e;function pe(e,c,f){{if(_e===void 0)try{throw Error()}catch(S){var x=S.stack.trim().match(/\n( *(at )?)/);_e=x&&x[1]||""}return`
|
|
18
|
+
`+_e+e}}var Ie=!1,ve;{var en=typeof WeakMap=="function"?WeakMap:Map;ve=new en}function ot(e,c){if(!e||Ie)return"";{var f=ve.get(e);if(f!==void 0)return f}var x;Ie=!0;var S=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var E;E=Ee.current,Ee.current=null,qt();try{if(c){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(B){x=B}Reflect.construct(e,[],w)}else{try{w.call()}catch(B){x=B}e.call(w.prototype)}}else{try{throw Error()}catch(B){x=B}e()}}catch(B){if(B&&x&&typeof B.stack=="string"){for(var b=B.stack.split(`
|
|
19
|
+
`),W=x.stack.split(`
|
|
20
|
+
`),P=b.length-1,D=W.length-1;P>=1&&D>=0&&b[P]!==W[D];)D--;for(;P>=1&&D>=0;P--,D--)if(b[P]!==W[D]){if(P!==1||D!==1)do if(P--,D--,D<0||b[P]!==W[D]){var U=`
|
|
21
|
+
`+b[P].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),typeof e=="function"&&ve.set(e,U),U}while(P>=1&&D>=0);break}}}finally{Ie=!1,Ee.current=E,Qt(),Error.prepareStackTrace=S}var te=e?e.displayName||e.name:"",$=te?pe(te):"";return typeof e=="function"&&ve.set(e,$),$}function tn(e,c,f){return ot(e,!1)}function nn(e){var c=e.prototype;return!!(c&&c.isReactComponent)}function ge(e,c,f){if(e==null)return"";if(typeof e=="function")return ot(e,nn(e));if(typeof e=="string")return pe(e);switch(e){case o:return pe("Suspense");case u:return pe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return tn(e.render);case v:return ge(e.type,c,f);case g:{var x=e,S=x._payload,E=x._init;try{return ge(E(S),c,f)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,st={},it=C.ReactDebugCurrentFrame;function xe(e){if(e){var c=e._owner,f=ge(e.type,e._source,c?c.type:null);it.setExtraStackFrame(f)}else it.setExtraStackFrame(null)}function rn(e,c,f,x,S){{var E=Function.call.bind(de);for(var w in e)if(E(e,w)){var b=void 0;try{if(typeof e[w]!="function"){var W=Error((x||"React class")+": "+f+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}b=e[w](c,w,x,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){b=P}b&&!(b instanceof Error)&&(xe(S),k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",x||"React class",f,w,typeof b),xe(null)),b instanceof Error&&!(b.message in st)&&(st[b.message]=!0,xe(S),k("Failed %s type: %s",f,b.message),xe(null))}}}var an=Array.isArray;function Te(e){return an(e)}function on(e){{var c=typeof Symbol=="function"&&Symbol.toStringTag,f=c&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f}}function sn(e){try{return ct(e),!1}catch{return!0}}function ct(e){return""+e}function lt(e){if(sn(e))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",on(e)),ct(e)}var dt=C.ReactCurrentOwner,cn={key:!0,ref:!0,__self:!0,__source:!0},ut,ft;function ln(e){if(de.call(e,"ref")){var c=Object.getOwnPropertyDescriptor(e,"ref").get;if(c&&c.isReactWarning)return!1}return e.ref!==void 0}function dn(e){if(de.call(e,"key")){var c=Object.getOwnPropertyDescriptor(e,"key").get;if(c&&c.isReactWarning)return!1}return e.key!==void 0}function un(e,c){typeof e.ref=="string"&&dt.current}function fn(e,c){{var f=function(){ut||(ut=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}}function hn(e,c){{var f=function(){ft||(ft=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};f.isReactWarning=!0,Object.defineProperty(e,"ref",{get:f,configurable:!0})}}var pn=function(e,c,f,x,S,E,w){var b={$$typeof:r,type:e,key:c,ref:f,props:w,_owner:E};return b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(b,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(b,"_source",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b};function vn(e,c,f,x,S){{var E,w={},b=null,W=null;f!==void 0&&(lt(f),b=""+f),dn(c)&&(lt(c.key),b=""+c.key),ln(c)&&(W=c.ref,un(c,S));for(E in c)de.call(c,E)&&!cn.hasOwnProperty(E)&&(w[E]=c[E]);if(e&&e.defaultProps){var P=e.defaultProps;for(E in P)w[E]===void 0&&(w[E]=P[E])}if(b||W){var D=typeof e=="function"?e.displayName||e.name||"Unknown":e;b&&fn(w,D),W&&hn(w,D)}return pn(e,b,W,S,x,dt.current,w)}}var Fe=C.ReactCurrentOwner,ht=C.ReactDebugCurrentFrame;function ee(e){if(e){var c=e._owner,f=ge(e.type,e._source,c?c.type:null);ht.setExtraStackFrame(f)}else ht.setExtraStackFrame(null)}var Pe;Pe=!1;function De(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function pt(){{if(Fe.current){var e=G(Fe.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function gn(e){return""}var vt={};function xn(e){{var c=pt();if(!c){var f=typeof e=="string"?e:e.displayName||e.name;f&&(c=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+f+">.")}return c}}function gt(e,c){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var f=xn(c);if(vt[f])return;vt[f]=!0;var x="";e&&e._owner&&e._owner!==Fe.current&&(x=" It was passed a child from "+G(e._owner.type)+"."),ee(e),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,x),ee(null)}}function xt(e,c){{if(typeof e!="object")return;if(Te(e))for(var f=0;f<e.length;f++){var x=e[f];De(x)&>(x,c)}else if(De(e))e._store&&(e._store.validated=!0);else if(e){var S=z(e);if(typeof S=="function"&&S!==e.entries)for(var E=S.call(e),w;!(w=E.next()).done;)De(w.value)&>(w.value,c)}}}function mn(e){{var c=e.type;if(c==null||typeof c=="string")return;var f;if(typeof c=="function")f=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===d||c.$$typeof===v))f=c.propTypes;else return;if(f){var x=G(c);rn(f,e.props,"prop",x,e)}else if(c.PropTypes!==void 0&&!Pe){Pe=!0;var S=G(c);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",S||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function bn(e){{for(var c=Object.keys(e.props),f=0;f<c.length;f++){var x=c[f];if(x!=="children"&&x!=="key"){ee(e),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),ee(null);break}}e.ref!==null&&(ee(e),k("Invalid attribute `ref` supplied to `React.Fragment`."),ee(null))}}var mt={};function bt(e,c,f,x,S,E){{var w=Re(e);if(!w){var b="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=gn();W?b+=W:b+=pt();var P;e===null?P="null":Te(e)?P="array":e!==void 0&&e.$$typeof===r?(P="<"+(G(e.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,b)}var D=vn(e,c,f,S,E);if(D==null)return D;if(w){var U=c.children;if(U!==void 0)if(x)if(Te(U)){for(var te=0;te<U.length;te++)xt(U[te],e);Object.freeze&&Object.freeze(U)}else k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else xt(U,e)}if(de.call(c,"key")){var $=G(e),B=Object.keys(c).filter(function(Cn){return Cn!=="key"}),Ae=B.length>0?"{key: someKey, "+B.join(": ..., ")+": ...}":"{key: someKey}";if(!mt[$+Ae]){var Sn=B.length>0?"{"+B.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Ce,q,or,q),it[q+Ce]=!0}}return e===c?Zt(T):Qt(T),T}}function er(e,o,l){return at(e,o,l,!0)}function tr(e,o,l){return at(e,o,l,!1)}var rr=tr,nr=er;J.Fragment=c,J.jsx=rr,J.jsxs=nr}()),J}process.env.NODE_ENV==="production"?de.exports=ct():de.exports=lt();var t=de.exports;const re=100,ne="http://localhost:1633",Ee="swarm-connect:bee-api-url",a={colors:{primary:"#1a56db",primaryHover:"#1e429f",success:"#0e9f6e",successLight:"#f0fdf4",error:"#f05252",errorLight:"#fff5f5",warning:"#ff8a4c",warningLight:"#fffbf5",border:"#e5e7eb",text:"#111827",muted:"#6b7280",overlay:"rgba(0,0,0,0.5)",stepActive:"#1a56db"}};function Ie(r=ne){const[n,s]=E.useState({isRunning:!1,isChecking:!1}),c=E.useCallback(async()=>{s({isRunning:!1,isChecking:!0});try{const u=await fetch(`${r}/health`,{signal:AbortSignal.timeout(5e3)});if(u.ok){const p=await u.json();s({isRunning:!0,isChecking:!1,version:p.version})}else s({isRunning:!1,isChecking:!1,error:`Node returned HTTP ${u.status}`})}catch{s({isRunning:!1,isChecking:!1,error:`Cannot reach Bee node at ${r}`})}},[r]);return{...n,check:c}}function Te(r=ne){const[n,s]=E.useState([]),[c,u]=E.useState(!1),[p,g]=E.useState(),[x,f]=E.useState(),i=E.useCallback(async()=>{u(!0),g(void 0);try{const d=await fetch(`${r}/stamps`,{signal:AbortSignal.timeout(5e3)});if(d.ok){const v=await d.json();s(v.stamps??[])}else g(`HTTP ${d.status}`)}catch{g("Could not fetch postage stamps")}finally{u(!1)}},[r]);return{stamps:n,isLoading:c,error:p,fetchStamps:i,selectedStampId:x,selectStamp:f}}function ut(){if(!(typeof window>"u"))try{return window.localStorage.getItem(Ee)??void 0}catch{return}}function Pe(r={}){const[n,s]=E.useState(()=>r.beeApiUrl??ut()??ne);E.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Ee,n)}catch{}},[n]);const c=Ie(n),u=Te(n),{address:p,isConnected:g}=U.useAccount(),x=U.useChainId(),f=x===re;return{beeNode:c,stamps:u,beeApiUrl:n,setBeeApiUrl:s,isWalletConnected:g,address:p,isOnGnosis:f,chainId:x,isFullyConnected:c.isRunning&&!!u.selectedStampId&&g&&f}}function fe({step:r,done:n=!1,children:s}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[t.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",flexShrink:0,fontSize:11,fontWeight:700,lineHeight:1,color:"#fff",background:n?a.colors.success:a.colors.stepActive},children:n?"✓":r}),t.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:a.colors.muted},children:s})]})}function dt({beeApiUrl:r,setBeeApiUrl:n,beeNode:s,stamps:c}){return E.useEffect(()=>{s.check()},[r]),E.useEffect(()=>{s.isRunning&&c.fetchStamps()},[s.isRunning]),t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx(fe,{step:1,done:s.isRunning,children:"Bee Node"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(ft,{value:r,disabled:s.isChecking,onSubmit:n}),t.jsx(pt,{beeApiUrl:r,status:s,onRetry:s.check})]})]}),t.jsxs("section",{style:{opacity:s.isRunning?1:.5},children:[t.jsx(fe,{step:2,done:!!c.selectedStampId,children:"Postage Stamp"}),s.isRunning?t.jsx(gt,{stamps:c}):t.jsx(ht,{children:"Connect a running Bee node to load postage stamps."})]})]})}function ft({value:r,disabled:n,onSubmit:s}){const[c,u]=E.useState(r);E.useEffect(()=>{u(r)},[r]);const p=c.trim().replace(/\/+$/,""),g=p!==r&&p.length>0,x=()=>{g&&s(p)};return t.jsxs("div",{style:{display:"flex",gap:6},children:[t.jsx("input",{type:"url",value:c,disabled:n,onChange:f=>u(f.target.value),onKeyDown:f=>{f.key==="Enter"&&x()},placeholder:"http://localhost:1633",spellCheck:!1,autoComplete:"off",style:{flex:1,minWidth:0,padding:"8px 10px",fontSize:13,fontFamily:"monospace",border:`1px solid ${a.colors.border}`,borderRadius:6,color:a.colors.text,outline:"none",background:n?"#f9fafb":"#fff"}}),t.jsx("button",{onClick:x,disabled:n||!g,style:{...he,alignSelf:"auto",cursor:n||!g?"default":"pointer",opacity:n||!g?.5:1},children:"Connect"})]})}function ht({children:r}){return t.jsxs("div",{style:{...N,color:a.colors.muted,fontSize:13,borderStyle:"dashed",background:"#fafafa"},children:[t.jsx("span",{style:{fontSize:13},children:"🔒"}),t.jsx("span",{children:r})]})}function pt({beeApiUrl:r,status:n,onRetry:s}){return n.isChecking?t.jsxs("div",{style:N,children:[t.jsx(De,{}),t.jsxs("span",{style:{color:a.colors.muted,fontSize:14},children:["Checking ",r,"…"]})]}):n.isRunning?t.jsxs("div",{style:{...N,borderColor:a.colors.success,background:a.colors.successLight},children:[t.jsx(Ae,{color:a.colors.success}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:600,color:a.colors.success,fontSize:14},children:"Node running"}),n.version&&t.jsxs("div",{style:{color:a.colors.muted,fontSize:12},children:["v",n.version]})]})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsxs("div",{style:{...N,borderColor:a.colors.error,background:a.colors.errorLight},children:[t.jsx(Ae,{color:a.colors.error}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:600,color:a.colors.error,fontSize:14},children:"Node not reachable"}),t.jsx("div",{style:{color:a.colors.muted,fontSize:12},children:n.error??`Cannot reach ${r}`})]})]}),t.jsxs("div",{style:{fontSize:12,color:a.colors.muted},children:["Start: ",t.jsx("code",{style:{background:"#f3f4f6",padding:"1px 5px",borderRadius:3},children:"bee start"})]}),t.jsx("button",{onClick:s,style:he,children:"Retry"})]})}function gt({stamps:r}){return r.isLoading?t.jsxs("div",{style:{...N,gap:10},children:[t.jsx(De,{}),t.jsx("span",{style:{color:a.colors.muted,fontSize:14},children:"Loading stamps…"})]}):r.error?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("div",{style:{...N,borderColor:a.colors.error,background:a.colors.errorLight},children:t.jsx("span",{style:{color:a.colors.error,fontSize:13},children:r.error})}),t.jsx("button",{onClick:r.fetchStamps,style:he,children:"Retry"})]}):r.stamps.length===0?t.jsxs("div",{style:{...N,flexDirection:"column",alignItems:"flex-start",gap:4},children:[t.jsx("div",{style:{fontSize:14,color:a.colors.muted},children:"No postage stamps found."}),t.jsx("div",{style:{fontSize:12,color:a.colors.muted},children:"Buy a stamp via the Bee API or Swarm Desktop to continue."})]}):t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:r.stamps.map(n=>t.jsx(vt,{stamp:n,selected:r.selectedStampId===n.batchID,onSelect:()=>r.selectStamp(n.batchID)},n.batchID))})}function vt({stamp:r,selected:n,onSelect:s}){const c=Math.floor(r.batchTTL/86400),u=`${r.batchID.slice(0,8)}…${r.batchID.slice(-6)}`;return t.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",border:`1.5px solid ${n?a.colors.primary:a.colors.border}`,borderRadius:8,cursor:"pointer",background:n?"#eff6ff":"#fff",textAlign:"left",width:"100%",transition:"all 0.15s"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:a.colors.text},children:u}),r.label&&t.jsx("div",{style:{fontSize:12,color:a.colors.muted,marginTop:2},children:r.label})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("span",{style:{fontSize:11,color:a.colors.muted},children:c>0?`${c}d`:"expiring"}),r.usable?t.jsx(Oe,{bg:a.colors.successLight,color:a.colors.success,children:"usable"}):t.jsx(Oe,{bg:a.colors.errorLight,color:a.colors.error,children:"unusable"}),t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",flexShrink:0,border:`2px solid ${n?a.colors.primary:a.colors.border}`,background:n?a.colors.primary:"transparent"}})]})]})}function Oe({children:r,bg:n,color:s}){return t.jsx("span",{style:{fontSize:11,background:n,color:s,borderRadius:4,padding:"2px 6px"},children:r})}function Ae({color:r}){return t.jsx("span",{style:{fontSize:10,color:r,lineHeight:1},children:"●"})}function De(){return t.jsx("div",{style:{width:15,height:15,flexShrink:0,border:"2px solid #e5e7eb",borderTopColor:a.colors.primary,borderRadius:"50%",animation:"spin 0.7s linear infinite"}})}const N={display:"flex",alignItems:"center",gap:12,padding:"11px 14px",border:`1px solid ${a.colors.border}`,borderRadius:8,background:"#fff"},he={background:"none",border:`1px solid ${a.colors.border}`,borderRadius:6,padding:"5px 14px",cursor:"pointer",fontSize:13,color:a.colors.muted,alignSelf:"flex-start"};function yt(r){const n={formatters:void 0,fees:void 0,serializers:void 0,...r};function s(c){return u=>{const p=typeof u=="function"?u(c):u,g={...c,...p};return Object.assign(g,{extend:s(g)})}}return Object.assign(n,{extend:s(n)})}const pe=yt({id:100,name:"Gnosis",nativeCurrency:{decimals:18,name:"xDAI",symbol:"XDAI"},blockTime:5e3,rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{default:{name:"Gnosisscan",url:"https://gnosisscan.io",apiUrl:"https://api.gnosisscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}});function bt({swarmReady:r}){const{address:n,isConnected:s}=U.useAccount(),c=U.useChainId(),u=c===re;return t.jsxs("section",{style:{opacity:r?1:.5},children:[t.jsx(fe,{step:3,done:s&&u,children:"Wallet"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s?t.jsx(mt,{address:n}):r?t.jsx(jt,{}):t.jsx(xt,{}),s&&t.jsx(wt,{isOnGnosis:u,chainId:c})]})]})}function mt({address:r}){const{disconnect:n}=U.useDisconnect();return t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"11px 14px",border:`1px solid ${a.colors.success}`,borderRadius:8,background:a.colors.successLight},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:600,color:a.colors.success,fontSize:14},children:"Connected"}),r&&t.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:a.colors.muted,marginTop:2},children:`${r.slice(0,8)}…${r.slice(-6)}`})]}),t.jsx("button",{onClick:()=>n(),style:{background:"none",border:`1px solid ${a.colors.border}`,borderRadius:6,padding:"5px 12px",cursor:"pointer",fontSize:12,color:a.colors.muted},children:"Disconnect"})]})}function xt(){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"11px 14px",border:`1px dashed ${a.colors.border}`,borderRadius:8,background:"#fafafa"},children:[t.jsx("span",{style:{fontSize:13},children:"🔒"}),t.jsx("span",{style:{fontSize:13,color:a.colors.muted},children:"Complete steps 1 and 2 — a running Bee node and a selected postage stamp — to connect your wallet."})]})}function jt(){const{connectors:r,connect:n,isPending:s,error:c}=U.useConnect();return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[r.map(u=>t.jsxs("button",{onClick:()=>n({connector:u}),disabled:s,style:{display:"flex",alignItems:"center",gap:10,padding:"11px 14px",border:`1.5px solid ${a.colors.border}`,borderRadius:8,cursor:s?"not-allowed":"pointer",background:"#fff",fontSize:14,fontWeight:500,color:a.colors.text,opacity:s?.6:1,transition:"border-color 0.15s",width:"100%"},onMouseOver:p=>{s||(p.currentTarget.style.borderColor=a.colors.primary)},onMouseOut:p=>{p.currentTarget.style.borderColor=a.colors.border},children:[u.icon?t.jsx("img",{src:u.icon,width:20,height:20,alt:"",style:{borderRadius:4}}):t.jsx("span",{style:{width:20,textAlign:"center",fontSize:16},children:"🔗"}),u.name]},u.uid)),c&&t.jsx("div",{style:{fontSize:12,color:a.colors.error,marginTop:2},children:c.message})]})}function wt({isOnGnosis:r,chainId:n}){const{switchChain:s,isPending:c,error:u}=U.useSwitchChain();return r?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"11px 14px",border:`1px solid ${a.colors.success}`,borderRadius:8,background:a.colors.successLight},children:[t.jsx("span",{style:{color:a.colors.success,fontSize:10,lineHeight:1},children:"●"}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:600,color:a.colors.success,fontSize:14},children:"Gnosis chain"}),t.jsxs("div",{style:{fontSize:12,color:a.colors.muted},children:["Chain ID ",re]})]})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"11px 14px",border:`1px solid ${a.colors.warning}`,borderRadius:8,background:a.colors.warningLight},children:[t.jsx("span",{style:{color:a.colors.warning,fontSize:10,lineHeight:1},children:"●"}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:600,color:a.colors.warning,fontSize:14},children:"Wrong network"}),t.jsxs("div",{style:{fontSize:12,color:a.colors.muted},children:["Chain ",n??"—"," active — Gnosis (",re,") required"]})]})]}),t.jsx("button",{onClick:()=>s({chainId:pe.id}),disabled:c,style:{background:a.colors.primary,color:"#fff",border:"none",borderRadius:6,padding:"9px 20px",cursor:c?"not-allowed":"pointer",fontSize:14,fontWeight:500,opacity:c?.7:1,alignSelf:"flex-start"},children:c?"Switching…":"Switch to Gnosis"}),u&&t.jsx("div",{style:{fontSize:12,color:a.colors.error},children:u.message})]})}function We({onClose:r,beeNode:n,stamps:s,beeApiUrl:c,setBeeApiUrl:u}){const p=n.isRunning&&!!s.selectedStampId;return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
<%s key={someKey} {...props} />`,Ae,$,Sn,$),mt[$+Ae]=!0}}return e===i?bn(D):mn(D),D}}function yn(e,c,f){return bt(e,c,f,!0)}function wn(e,c,f){return bt(e,c,f,!1)}var kn=wn,jn=yn;re.Fragment=i,re.jsx=kn,re.jsxs=jn}()),re}process.env.NODE_ENV==="production"?me.exports=yt():me.exports=wt();var t=me.exports;const H=100,ae="http://localhost:1633",We="swarm-connect:bee-api-url",Be="0xdBF3Ea6F5beE45c02255B2c26a16F300502F68da",be=16,kt="0.1",jt="0.5",St=20,Ct="1000000000";function Me(n=ae){const[r,a]=m.useState({isRunning:!1,isChecking:!1}),i=m.useCallback(async()=>{a({isRunning:!1,isChecking:!0});try{const s=await fetch(`${n}/health`,{signal:AbortSignal.timeout(5e3)});if(s.ok){const l=await s.json();a({isRunning:!0,isChecking:!1,version:l.version})}else a({isRunning:!1,isChecking:!1,error:`Node returned HTTP ${s.status}`})}catch{a({isRunning:!1,isChecking:!1,error:`Cannot reach Bee node at ${n}`})}},[n]);return{...r,check:i}}function Ue(n=ae){const[r,a]=m.useState([]),[i,s]=m.useState(!1),[l,p]=m.useState(),[h,d]=m.useState(),[o,u]=m.useState(!1),[v,g]=m.useState(),y=m.useCallback(async()=>{s(!0),p(void 0);try{const I=await fetch(`${n}/stamps`,{signal:AbortSignal.timeout(5e3)});if(I.ok){const z=await I.json();a(z.stamps??[])}else p(`HTTP ${I.status}`)}catch{p("Could not fetch postage stamps")}finally{s(!1)}},[n]),T=m.useCallback(async({amount:I,depth:z,label:C})=>{u(!0),g(void 0);try{const k=C?`?label=${encodeURIComponent(C)}`:"",F=await fetch(`${n}/stamps/${I}/${z}${k}`,{method:"POST",signal:AbortSignal.timeout(24e4)});if(!F.ok){let j=`HTTP ${F.status}`;try{const A=await F.json();A.message&&(j=A.message)}catch{}g(j);return}const R=await F.json();return d(R.batchID),y(),R.batchID}catch{g("Stamp purchase failed — is the node wallet funded with xDAI and xBZZ?");return}finally{u(!1)}},[n,y]);return{stamps:r,isLoading:i,error:l,fetchStamps:y,selectedStampId:h,selectStamp:d,createStamp:T,isCreating:o,createError:v}}function ye(n=ae){const[r,a]=m.useState({isLoading:!1}),i=m.useCallback(async()=>{a(s=>({...s,isLoading:!0,error:void 0}));try{const[s,l]=await Promise.all([fetch(`${n}/addresses`,{signal:AbortSignal.timeout(5e3)}),fetch(`${n}/wallet`,{signal:AbortSignal.timeout(5e3)})]);if(!s.ok||!l.ok){a(u=>({...u,isLoading:!1,error:`Node returned HTTP ${s.ok?l.status:s.status}`}));return}const p=await s.json(),h=await l.json(),d=h.bzzBalance??h.bzz,o=h.nativeTokenBalance??h.xDai;a({address:p.ethereum,xdai:o!==void 0?Number(o)/1e18:void 0,xbzz:d!==void 0?Number(d)/10**be:void 0,isLoading:!1})}catch{a(s=>({...s,isLoading:!1,error:`Cannot read node wallet at ${n}`}))}},[n]);return{...r,isFunded:(r.xdai??0)>0&&(r.xbzz??0)>0,refresh:i}}function Rt(){if(!(typeof window>"u"))try{return window.localStorage.getItem(We)??void 0}catch{return}}function Ne(n={}){const[r,a]=m.useState(()=>n.beeApiUrl??Rt()??ae);m.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(We,r)}catch{}},[r]);const i=n.stampMode??"select",s=Me(r),l=Ue(r),p=ye(r),{address:h,isConnected:d}=O.useAccount(),o=O.useChainId(),u=o===H,{data:v,isLoading:g}=O.useBalance({address:h,chainId:H,query:{enabled:d}}),y=v?Number(v.formatted):void 0,T=u&&!!v&&v.value>0n;return{beeNode:s,stamps:l,beeApiUrl:r,setBeeApiUrl:a,stampMode:i,nodeWallet:p,isWalletConnected:d,address:h,isOnGnosis:u,chainId:o,balance:{xdai:y,isLoading:d&&g,hasGas:T},isFullyConnected:d&&u&&T&&s.isRunning&&(i==="select"||p.isFunded)&&!!l.selectedStampId}}const Et=`
|
|
31
|
+
.swarm-connect {
|
|
32
|
+
--void:#060809; --bunker:#0b0f12; --surface:#121821; --raised:#18202b; --raised-2:#1e2833;
|
|
33
|
+
--line:rgba(255,255,255,0.07); --line-2:rgba(255,255,255,0.12); --line-orange:rgba(255,107,0,0.45);
|
|
34
|
+
--fg:#f3f5f7; --fg-soft:#c3cad3; --fg-muted:#7d8794; --fg-faint:#565f6b;
|
|
35
|
+
--accent:#ff6b00; --accent-bright:#ff8a33; --accent-deep:#d65500; --accent-ink:#1a0e02;
|
|
36
|
+
--accent-glow:rgba(255,107,0,0.40); --accent-wash:rgba(255,107,0,0.10);
|
|
37
|
+
--ok:#36c46a; --ok-wash:rgba(54,196,106,0.12); --ok-line:rgba(54,196,106,0.40);
|
|
38
|
+
--bad:#ff5640; --bad-wash:rgba(255,86,64,0.12); --bad-line:rgba(255,86,64,0.38);
|
|
39
|
+
--warn:#f0a83a; --warn-wash:rgba(240,168,58,0.12); --warn-line:rgba(240,168,58,0.40);
|
|
40
|
+
--font-display:'Space Grotesk',system-ui,sans-serif;
|
|
41
|
+
--font-body:'Inter',system-ui,sans-serif;
|
|
42
|
+
--font-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
|
|
43
|
+
--ease:cubic-bezier(0.22,0.61,0.36,1);
|
|
44
|
+
}
|
|
45
|
+
@keyframes sc-spin { to { transform: rotate(360deg); } }
|
|
46
|
+
@keyframes sc-pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(.82); } }
|
|
47
|
+
@keyframes sc-modal-in { from { opacity:0; transform:translate(-50%, calc(-50% + 10px)) scale(.985); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
|
|
48
|
+
@keyframes sc-backdrop-in { from { opacity:0; } to { opacity:1; } }
|
|
49
|
+
@keyframes sc-step-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
|
|
50
|
+
.sc-scroll::-webkit-scrollbar { width:8px; }
|
|
51
|
+
.sc-scroll::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }
|
|
52
|
+
.sc-scroll::-webkit-scrollbar-track { background:transparent; }
|
|
53
|
+
`;let Ye=!1;function Ge(){if(Ye||typeof document>"u")return;Ye=!0;const n=document.createElement("style");n.dataset.swarmConnect="",n.textContent=Et,document.head.appendChild(n)}function _t({size:n=18,stroke:r="var(--accent)",glow:a=!0,children:i}){return t.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",filter:a?"drop-shadow(0 0 6px var(--accent-glow))":"none"},children:t.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round",children:i})})}function oe({size:n=15}){return t.jsx("span",{style:{width:n,height:n,flexShrink:0,display:"inline-block",border:"2px solid rgba(255,255,255,.12)",borderTopColor:"var(--accent)",borderRadius:"50%",animation:"sc-spin .7s linear infinite"}})}function se({children:n,tone:r}){const a={ok:{c:"var(--ok)",b:"var(--ok-line)",w:"var(--ok-wash)"},bad:{c:"var(--bad)",b:"var(--bad-line)",w:"var(--bad-wash)"},warn:{c:"var(--warn)",b:"var(--warn-line)",w:"var(--warn-wash)"}}[r];return t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:".04em",textTransform:"uppercase",color:a.c,background:a.w,border:`1px solid ${a.b}`,borderRadius:3,padding:"2px 6px",lineHeight:1.3},children:n})}function V({tone:n,title:r,sub:a,children:i}){const s={ok:{b:"var(--ok-line)",w:"var(--ok-wash)",d:"var(--ok)"},bad:{b:"var(--bad-line)",w:"var(--bad-wash)",d:"var(--bad)"},warn:{b:"var(--warn-line)",w:"var(--warn-wash)",d:"var(--warn)"},flat:{b:"var(--line)",w:"var(--raised)",d:"var(--fg-muted)"}}[n],l=!!a&&(a.startsWith("0x")||a.includes("localhost")||a.includes("http"));return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",border:`1px solid ${s.b}`,borderRadius:8,background:s.w},children:[n!=="flat"&&t.jsx("span",{style:{width:8,height:8,flexShrink:0,borderRadius:"50%",background:s.d,boxShadow:`0 0 8px ${s.d}`,animation:n==="warn"?"sc-pulse-dot 1.6s var(--ease) infinite":"none"}}),t.jsxs("div",{style:{minWidth:0},children:[r&&t.jsx("div",{style:{fontWeight:600,fontSize:13.5,color:n==="flat"?"var(--fg-soft)":s.d},children:r}),a&&t.jsx("div",{style:{fontSize:12,color:"var(--fg-muted)",marginTop:2,fontFamily:l?"var(--font-mono)":"inherit",wordBreak:"break-all"},children:a})]}),i&&t.jsx("div",{style:{marginLeft:"auto",flexShrink:0},children:i})]})}function Z({children:n,onClick:r,disabled:a}){const[i,s]=m.useState(!1);return t.jsx("button",{onClick:r,disabled:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{fontFamily:"var(--font-mono)",fontSize:12,letterSpacing:".04em",background:"transparent",border:`1px solid ${i&&!a?"var(--line-orange)":"var(--line-2)"}`,color:a?"var(--fg-faint)":i?"var(--accent-bright)":"var(--fg-soft)",borderRadius:4,padding:"7px 14px",cursor:a?"default":"pointer",transition:"all .15s var(--ease)",opacity:a?.5:1},children:n})}function we({children:n,onClick:r,pending:a,block:i,style:s}){const[l,p]=m.useState(!1);return t.jsx("button",{onClick:r,disabled:a,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,fontFamily:"var(--font-mono)",fontSize:13,fontWeight:600,letterSpacing:".06em",textTransform:"uppercase",width:i?"100%":"auto",background:"var(--accent)",color:"var(--accent-ink)",border:"none",borderRadius:4,padding:"11px 20px",cursor:a?"default":"pointer",boxShadow:l?"0 0 24px var(--accent-glow)":"0 0 14px var(--accent-glow)",transform:l?"translateY(-1px)":"none",transition:"all .15s var(--ease)",opacity:a?.8:1,whiteSpace:"nowrap",...s},children:n})}function J({children:n}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 14px",border:"1px dashed var(--line-2)",borderRadius:8,background:"var(--bunker)"},children:[t.jsxs(_t,{size:15,stroke:"var(--fg-faint)",glow:!1,children:[t.jsx("rect",{x:"5",y:"11",width:"14",height:"9",rx:"1.5"}),t.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]}),t.jsx("span",{style:{fontSize:12.5,color:"var(--fg-muted)"},children:n})]})}function X({step:n,state:r,children:a,hint:i}){const s=r==="done",l=r==="locked";return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12},children:[t.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,flexShrink:0,fontFamily:"var(--font-mono)",fontSize:11,fontWeight:600,lineHeight:1,color:s?"var(--ok)":l?"var(--fg-faint)":"var(--accent-ink)",background:s?"var(--ok-wash)":l?"transparent":"var(--accent)",border:s?"1px solid var(--ok-line)":l?"1px solid var(--line-2)":"none",clipPath:"polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",boxShadow:!s&&!l?"0 0 14px var(--accent-glow)":"none"},children:s?"✓":n}),t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:".18em",color:l?"var(--fg-faint)":"var(--fg-soft)"},children:a}),i&&t.jsx("span",{style:{marginLeft:"auto",fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:".06em",color:"var(--fg-faint)"},children:i})]})}function It({size:n=30}){return t.jsx("span",{style:{width:n,height:n,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--accent)",color:"var(--accent-ink)",clipPath:"polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",boxShadow:"0 0 18px var(--accent-glow)"},children:t.jsxs("svg",{width:n*.56,height:n*.56,viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-ink)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("ellipse",{cx:"12",cy:"14",rx:"5",ry:"6.5"}),t.jsx("path",{d:"M7 12h10M7 16h10M12 7.5V4M12 4l-2.5-1.5M12 4l2.5-1.5"})]})})}function Tt({states:n}){return t.jsx("span",{style:{display:"inline-flex",gap:5},children:n.map((r,a)=>t.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:r?"var(--ok)":"var(--line-2)",boxShadow:r?"0 0 8px var(--ok)":"none",transition:"all .2s"}},a))})}function Ft(n){const r={formatters:void 0,fees:void 0,serializers:void 0,...n};function a(i){return s=>{const l=typeof s=="function"?s(i):s,p={...i,...l};return Object.assign(p,{extend:a(p)})}}return Object.assign(r,{extend:a(r)})}const ke=Ft({id:100,name:"Gnosis",nativeCurrency:{decimals:18,name:"xDAI",symbol:"XDAI"},blockTime:5e3,rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{default:{name:"Gnosisscan",url:"https://gnosisscan.io",apiUrl:"https://api.gnosisscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}});function He(n){if(n)return n.shortMessage??n.message}function Pt({name:n,icon:r,pending:a,disabled:i,onClick:s}){const[l,p]=m.useState(!1);return t.jsxs("button",{onClick:s,disabled:i||a,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{display:"flex",alignItems:"center",gap:12,width:"100%",textAlign:"left",padding:"11px 13px",borderRadius:8,cursor:i?"default":"pointer",opacity:i?.45:1,border:`1px solid ${l&&!i?"var(--line-orange)":"var(--line)"}`,background:l&&!i?"var(--raised-2)":"var(--raised)",transition:"all .15s var(--ease)"},children:[t.jsx("span",{style:{width:30,height:30,flexShrink:0,borderRadius:7,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--bunker)",border:"1px solid var(--line-2)",color:"var(--accent-bright)",overflow:"hidden",fontFamily:"var(--font-display)",fontWeight:700,fontSize:15},children:r?t.jsx("img",{src:r,width:30,height:30,alt:"",style:{borderRadius:7}}):n.charAt(0)}),t.jsx("span",{style:{flex:1,fontSize:14,fontWeight:500,color:"var(--fg)"},children:n}),a?t.jsx(oe,{size:14}):t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:16,color:l&&!i?"var(--accent)":"var(--fg-faint)",transition:"color .15s"},children:"→"})]})}function Dt({isConnected:n,address:r}){const{connectors:a,connect:i,isPending:s,variables:l,error:p}=O.useConnect(),{disconnect:h}=O.useDisconnect();if(n)return t.jsx(V,{tone:"ok",title:"Wallet connected",sub:r,children:t.jsx(Z,{onClick:()=>h(),children:"disconnect"})});const d=s&&l!=null&&l.connector&&"uid"in l.connector?l.connector.uid:void 0;return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[a.map(o=>t.jsx(Pt,{name:o.name,icon:o.icon,pending:d===o.uid,disabled:s&&d!==o.uid,onClick:()=>i({connector:o})},o.uid)),p&&t.jsx("div",{style:{fontSize:12,color:"var(--bad)",fontFamily:"var(--font-mono)"},children:p.message})]})}function At({locked:n,isOnGnosis:r,chainId:a}){const{switchChain:i,isPending:s}=O.useSwitchChain();return n?t.jsx(J,{children:"Connect a wallet to verify it is on the Gnosis chain."}):r?t.jsx(V,{tone:"ok",title:"Gnosis chain",sub:`chain id ${H}`,children:t.jsx(se,{tone:"ok",children:"synced"})}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(V,{tone:"warn",title:"Wrong network",sub:`chain ${a??"—"} active — Gnosis (${H}) required`}),t.jsx(we,{onClick:()=>i({chainId:ke.id}),pending:s,block:!0,children:s?"switching…":"switch to Gnosis"})]})}function je({symbol:n,role:r,amount:a,loading:i}){const s=!i&&a===0,l=s?"var(--warn)":"var(--ok)",p=s?"var(--warn-line)":"var(--ok-line)",h=s?"var(--warn-wash)":"var(--ok-wash)";return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",border:`1px solid ${i?"var(--line)":p}`,borderRadius:8,background:i?"var(--raised)":h},children:[i?t.jsx(oe,{size:14}):t.jsx("span",{style:{width:8,height:8,flexShrink:0,borderRadius:"50%",background:l,boxShadow:`0 0 8px ${l}`,animation:s?"sc-pulse-dot 1.6s var(--ease) infinite":"none"}}),t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{fontWeight:600,fontSize:13.5,color:i?"var(--fg-soft)":l},children:n}),t.jsx("div",{style:{fontSize:12,color:"var(--fg-muted)",marginTop:2},children:r})]}),t.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[!i&&t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:13.5,fontWeight:500,color:s?"var(--warn)":"var(--fg)"},children:a.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:4})}),!i&&t.jsx(se,{tone:s?"warn":"ok",children:s?"empty":"ok"})]})]})}function Ot({locked:n,balance:r}){if(n)return t.jsx(J,{children:"Switch to the Gnosis chain to read your wallet's xDAI balance."});const a=r.xdai??0,i=!r.isLoading&&a===0;return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx(je,{symbol:"xDAI",role:"gas for transactions from this wallet",amount:a,loading:r.isLoading}),t.jsx("div",{style:ie,children:"Your connected wallet signs and pays gas for its own transactions — separate from the wallet running your Bee node."}),i&&t.jsx(we,{onClick:()=>window.open("https://www.gnosisfaucet.com","_blank","noopener"),block:!0,children:"get xDAI"})]})}function zt({value:n,disabled:r,onSubmit:a}){const[i,s]=m.useState(n),[l,p]=m.useState(!1);m.useEffect(()=>{s(n)},[n]);const h=i.trim().replace(/\/+$/,""),d=h!==n&&h.length>0,o=()=>{d&&a(h)};return t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:8,padding:"0 12px",borderRadius:6,border:`1px solid ${l?"var(--line-orange)":"var(--line-2)"}`,background:r?"var(--bunker)":"var(--surface)",boxShadow:l?"0 0 0 3px var(--accent-wash)":"none",transition:"all .15s var(--ease)"},children:[t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--accent)"},children:">"}),t.jsx("input",{type:"url",value:i,disabled:r,spellCheck:!1,autoComplete:"off",onFocus:()=>p(!0),onBlur:()=>p(!1),onChange:u=>s(u.target.value),onKeyDown:u=>{u.key==="Enter"&&o()},placeholder:"http://localhost:1633",style:{flex:1,minWidth:0,background:"transparent",border:"none",outline:"none",color:"var(--fg)",fontFamily:"var(--font-mono)",fontSize:12.5,padding:"9px 0"}})]}),t.jsx(Z,{onClick:o,disabled:r||!d,children:"connect"})]})}function Lt({node:n,beeApiUrl:r}){return n.isChecking?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",border:"1px solid var(--line)",borderRadius:8,background:"var(--raised)"},children:[t.jsx(oe,{}),t.jsxs("span",{style:{color:"var(--fg-muted)",fontSize:13,fontFamily:"var(--font-mono)"},children:["probing ",r,"…"]})]}):n.isRunning?t.jsx(V,{tone:"ok",title:"Node online",sub:`bee ${n.version??"—"} · ${r}`,children:t.jsx(se,{tone:"ok",children:"health ok"})}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(V,{tone:"bad",title:"Node unreachable",sub:n.error??`no /health response from ${r}`}),t.jsxs("div",{style:{fontSize:12,color:"var(--fg-muted)",display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[t.jsx("span",{children:"start one with"}),t.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11.5,background:"var(--bunker)",border:"1px solid var(--line)",color:"var(--accent-bright)",padding:"2px 7px",borderRadius:3},children:"bee start"}),t.jsx(Z,{onClick:n.check,children:"retry"})]})]})}function Ve({symbol:n,value:r,onChange:a,onSend:i,pending:s,confirming:l,done:p,disabled:h}){const d=s||l;return t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:8,padding:"0 12px",borderRadius:6,border:"1px solid var(--line-2)",background:d||h?"var(--bunker)":"var(--surface)"},children:[t.jsx("input",{inputMode:"decimal",value:r,disabled:d||h,spellCheck:!1,onChange:o=>a(o.target.value),style:{flex:1,minWidth:0,background:"transparent",border:"none",outline:"none",color:"var(--fg)",fontFamily:"var(--font-mono)",fontSize:12.5,padding:"8px 0"}}),t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--fg-muted)",flexShrink:0},children:n})]}),p?t.jsx(se,{tone:"ok",children:"sent"}):t.jsx(Z,{onClick:i,disabled:d||h||!r.trim(),children:s?"sign…":l?"mining…":`send ${n.toLowerCase()}`})]})}function Wt({to:n,onSettled:r}){const[a,i]=m.useState(kt),[s,l]=m.useState(jt),{address:p}=O.useAccount(),h=O.useSendTransaction(),d=O.useWriteContract(),o=O.useWaitForTransactionReceipt({hash:h.data}),u=O.useWaitForTransactionReceipt({hash:d.data});m.useEffect(()=>{o.isSuccess&&r()},[o.isSuccess]),m.useEffect(()=>{u.isSuccess&&r()},[u.isSuccess]);const v=O.useReadContract({abi:_.erc20Abi,address:Be,functionName:"balanceOf",args:p?[p]:void 0,chainId:H,query:{enabled:!!p}}),g=v.data!==void 0?Number(v.data)/10**be:void 0,y=(g??0)>0,T=()=>{const C=Ze(()=>_.parseEther(a.trim()));C!==void 0&&h.sendTransaction({to:n,value:C,chainId:H})},I=()=>{const C=Ze(()=>_.parseUnits(s.trim(),be));C!==void 0&&d.writeContract({abi:_.erc20Abi,address:Be,functionName:"transfer",args:[n,C],chainId:H})},z=He(h.error)??He(d.error);return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("div",{style:ie,children:"One-time top-up — sent from your connected wallet to the node wallet:"}),t.jsx(Ve,{symbol:"xDAI",value:a,onChange:i,onSend:T,pending:h.isPending,confirming:o.isLoading&&!!h.data,done:o.isSuccess,disabled:!1}),t.jsx(Ve,{symbol:"xBZZ",value:s,onChange:l,onSend:I,pending:d.isPending,confirming:u.isLoading&&!!d.data,done:u.isSuccess,disabled:!y}),g!==void 0&&t.jsxs("div",{style:{...ie,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsxs("span",{children:["your wallet holds"," ",t.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:y?"var(--fg-soft)":"var(--warn)"},children:[g.toLocaleString("en-US",{maximumFractionDigits:4})," xBZZ"]})]}),!y&&t.jsx(Z,{onClick:()=>window.open("https://www.ethswarm.org/get-bzz","_blank","noopener"),children:"get xBZZ"})]}),z&&t.jsx("div",{style:{fontSize:12,color:"var(--bad)",fontFamily:"var(--font-mono)"},children:z})]})}function Ze(n){try{return n()}catch{return}}function Bt({locked:n,nodeWallet:r}){if(n)return t.jsx(J,{children:"Bring your Bee node online to read its wallet."});if(r.error)return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(V,{tone:"bad",title:"Could not read node wallet",sub:r.error}),t.jsx(Z,{onClick:r.refresh,children:"retry"})]});const a=r.isLoading&&r.xdai===void 0;return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx(je,{symbol:"xDAI",role:"gas for the node's own transactions",amount:r.xdai??0,loading:a}),t.jsx(je,{symbol:"xBZZ",role:"pays for postage stamps",amount:r.xbzz??0,loading:a}),t.jsxs("div",{style:ie,children:["The Bee node has its own wallet",r.address&&t.jsxs(t.Fragment,{children:[" ",t.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--fg-soft)"},children:[r.address.slice(0,8),"…",r.address.slice(-6)]})]})," ","— it buys and renews postage stamps on chain."]}),!r.isFunded&&r.address&&t.jsx(Wt,{to:r.address,onSettled:r.refresh})]})}function Mt({stamp:n,selected:r,onSelect:a}){const[i,s]=m.useState(!1),l=Math.floor(n.batchTTL/86400),p=`${n.batchID.slice(0,8)}…${n.batchID.slice(-6)}`,h=r||i;return t.jsxs("button",{onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"flex",alignItems:"center",gap:12,width:"100%",textAlign:"left",padding:"12px 14px",borderRadius:8,cursor:"pointer",border:`1px solid ${r?"var(--ok-line)":h?"var(--line-2)":"var(--line)"}`,background:r?"var(--ok-wash)":"var(--raised)",boxShadow:r?"0 0 0 1px var(--ok-line), 0 0 18px var(--ok-wash)":"none",transition:"all .15s var(--ease)"},children:[t.jsx("span",{style:{width:8,height:8,flexShrink:0,borderRadius:"50%",background:r?"var(--ok)":"var(--line-2)",boxShadow:r?"0 0 8px var(--ok)":"none",transition:"all .15s var(--ease)"}}),t.jsxs("div",{style:{minWidth:0,flex:1},children:[t.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:12.5,color:"var(--fg)"},children:p}),t.jsxs("div",{style:{fontSize:11.5,color:"var(--fg-muted)",marginTop:3,display:"flex",gap:8},children:[n.label&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:n.label}),t.jsx("span",{style:{color:"var(--fg-faint)"},children:"·"})]}),t.jsxs("span",{children:["depth ",n.depth]})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:l>30?"var(--fg-muted)":"var(--warn)"},children:l>0?`${l}d ttl`:"expiring"}),t.jsx(se,{tone:n.usable?"ok":"bad",children:n.usable?"usable":"unusable"})]})]})}function Se({label:n,value:r,onChange:a,placeholder:i,width:s}){return t.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,flex:s?`0 0 ${s}px`:1,minWidth:0},children:[t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:9.5,letterSpacing:".1em",textTransform:"uppercase",color:"var(--fg-faint)"},children:n}),t.jsx("input",{value:r,placeholder:i,spellCheck:!1,autoComplete:"off",onChange:l=>a(l.target.value),style:{minWidth:0,background:"var(--surface)",border:"1px solid var(--line-2)",borderRadius:6,outline:"none",color:"var(--fg)",fontFamily:"var(--font-mono)",fontSize:12,padding:"8px 10px"}})]})}function Ut({stamps:n}){const[r,a]=m.useState(""),[i,s]=m.useState(String(St)),[l,p]=m.useState(Ct);if(n.isCreating)return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",border:"1px solid var(--line)",borderRadius:8,background:"var(--raised)"},children:[t.jsx(oe,{}),t.jsx("span",{style:{color:"var(--fg-muted)",fontSize:13,fontFamily:"var(--font-mono)"},children:"buying stamp — waiting for the on-chain batch…"})]});const h=Number(i),d=Number.isInteger(h)&&h>=17&&/^\d+$/.test(l.trim());return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"12px 14px",border:"1px dashed var(--line-2)",borderRadius:8,background:"var(--bunker)"},children:[t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsx(Se,{label:"label",value:r,onChange:a,placeholder:"optional"}),t.jsx(Se,{label:"depth",value:i,onChange:s,width:64}),t.jsx(Se,{label:"amount (plur)",value:l,onChange:p,width:120})]}),t.jsx("div",{style:ie,children:"Cost ≈ 2^depth × amount PLUR, paid in xBZZ from the node wallet. Higher amount → longer stamp lifetime."}),t.jsx(we,{block:!0,onClick:()=>d&&n.createStamp({amount:l.trim(),depth:h,label:r.trim()||void 0}),style:d?void 0:{opacity:.5,cursor:"default"},children:"buy stamp"}),n.createError&&t.jsx("div",{style:{fontSize:12,color:"var(--bad)",fontFamily:"var(--font-mono)"},children:n.createError})]})}function Nt({stamps:n,locked:r,lockedHint:a,canCreate:i}){return r?t.jsx(J,{children:a}):n.isLoading?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",border:"1px solid var(--line)",borderRadius:8,background:"var(--raised)"},children:[t.jsx(oe,{}),t.jsx("span",{style:{color:"var(--fg-muted)",fontSize:13,fontFamily:"var(--font-mono)"},children:"reading /stamps…"})]}):n.error?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(V,{tone:"bad",title:"Could not read stamps",sub:n.error}),t.jsx(Z,{onClick:n.fetchStamps,children:"retry"})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.stamps.length===0&&!i&&t.jsx(J,{children:"No postage stamps on this node — buy one via the Bee API to continue."}),n.stamps.map(s=>t.jsx(Mt,{stamp:s,selected:n.selectedStampId===s.batchID,onSelect:()=>n.selectStamp(s.batchID)},s.batchID)),i&&t.jsx(Ut,{stamps:n})]})}const ie={fontSize:11.5,color:"var(--fg-faint)",lineHeight:1.5,paddingLeft:2};function Ke({onClose:n,beeNode:r,stamps:a,beeApiUrl:i,setBeeApiUrl:s,stampMode:l="select",nodeWallet:p}){Ge();const h=l==="create",{address:d,isConnected:o}=O.useAccount(),u=O.useChainId(),v=u===H,{data:g,isLoading:y}=O.useBalance({address:d,chainId:H,query:{enabled:o}}),T=g?Number(g.formatted):void 0,I=v&&!!g&&g.value>0n,z={xdai:T,isLoading:o&&y,hasGas:I},C=ye(i),k=p??C;m.useEffect(()=>{r.check()},[i]),m.useEffect(()=>{r.isRunning&&(a.fetchStamps(),h&&k.refresh())},[r.isRunning]);const F=o?"done":"active",R=o?v?"done":"active":"locked",j=v?I?"done":"active":"locked",A=I?r.isRunning?"done":"active":"locked",N=A!=="done"?"locked":k.isFunded?"done":"active",Q=h?N==="done":A==="done",Y=Q?a.selectedStampId?"done":"active":"locked",Re=h?6:5,K=Y==="done",he=[o,v,I,r.isRunning,...h?[k.isFunded]:[],!!a.selectedStampId],G=h?"wallet · chain · gas · node · fund · stamp":"wallet · chain · gas · node · stamp";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"swarm-connect",onClick:n,style:{position:"fixed",inset:0,zIndex:9998,background:"rgba(4,6,8,0.72)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",animation:"sc-backdrop-in .2s var(--ease)"}}),t.jsxs("div",{className:"swarm-connect",role:"dialog","aria-label":"Connect to Swarm",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999,width:440,maxWidth:"calc(100vw - 28px)",background:"var(--surface)",borderRadius:14,border:"1px solid var(--line-2)",boxShadow:"0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,107,0,.08), 0 0 60px rgba(255,107,0,.08)",overflow:"hidden",animation:"sc-modal-in .26s var(--ease) forwards",fontFamily:"var(--font-body)"},children:[t.jsxs("div",{style:{position:"relative",padding:"18px 20px 16px",borderBottom:"1px solid var(--line)",overflow:"hidden"},children:[t.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",background:"radial-gradient(ellipse 60% 140% at 88% 0%, var(--accent-wash), transparent 70%)"}}),t.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11},children:[t.jsx(It,{size:30}),t.jsxs("div",{children:[t.jsx("div",{style:{fontFamily:"var(--font-display)",fontWeight:600,fontSize:16,color:"var(--fg)",lineHeight:1.1},children:"Connect to Swarm"}),t.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:".12em",color:"var(--fg-muted)",marginTop:3},children:["// ",K?"ready":G]})]})]}),t.jsx("button",{onClick:n,"aria-label":"Close",style:{background:"transparent",border:"1px solid var(--line)",color:"var(--fg-muted)",width:30,height:30,borderRadius:6,cursor:"pointer",fontSize:18,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all .15s"},onMouseEnter:M=>{M.currentTarget.style.borderColor="var(--line-orange)",M.currentTarget.style.color="var(--accent-bright)"},onMouseLeave:M=>{M.currentTarget.style.borderColor="var(--line)",M.currentTarget.style.color="var(--fg-muted)"},children:"×"})]})]}),t.jsxs("div",{className:"sc-scroll",style:{padding:20,display:"flex",flexDirection:"column",gap:24,maxHeight:"62vh",overflowY:"auto"},children:[t.jsxs("section",{style:{animation:"sc-step-in .3s var(--ease)"},children:[t.jsx(X,{step:1,state:F,hint:o?"linked":null,children:"Wallet"}),t.jsx(Dt,{isConnected:o,address:d})]}),t.jsxs("section",{style:{opacity:R==="locked"?.55:1,transition:"opacity .3s var(--ease)"},children:[t.jsx(X,{step:2,state:R,hint:o?v?"gnosis":"wrong net":null,children:"Network chain"}),t.jsx(At,{locked:R==="locked",isOnGnosis:v,chainId:u})]}),t.jsxs("section",{style:{opacity:j==="locked"?.55:1,transition:"opacity .3s var(--ease)"},children:[t.jsx(X,{step:3,state:j,hint:v?I?"funded":"low":null,children:"Balance"}),t.jsx(Ot,{locked:j==="locked",balance:z})]}),t.jsxs("section",{style:{opacity:A==="locked"?.55:1,transition:"opacity .3s var(--ease)"},children:[t.jsx(X,{step:4,state:A,hint:r.isRunning?r.version:null,children:"Bee node"}),A==="locked"?t.jsx(J,{children:"Top up xDAI gas to unlock the Bee node connection."}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(zt,{value:i,disabled:r.isChecking,onSubmit:s}),t.jsx(Lt,{node:r,beeApiUrl:i})]})]}),h&&t.jsxs("section",{style:{opacity:N==="locked"?.55:1,transition:"opacity .3s var(--ease)"},children:[t.jsx(X,{step:5,state:N,hint:N==="locked"?null:k.isFunded?"funded":"top up",children:"Node wallet"}),t.jsx(Bt,{locked:N==="locked",nodeWallet:k})]}),t.jsxs("section",{style:{opacity:Y==="locked"?.55:1,transition:"opacity .3s var(--ease)"},children:[t.jsx(X,{step:Re,state:Y,hint:a.selectedStampId?"1 selected":Q?`${a.stamps.length} found`:null,children:"Postage stamp"}),t.jsx(Nt,{stamps:a,locked:Y==="locked",canCreate:h,lockedHint:h?"Fund the node wallet to manage postage stamps.":"Bring a node online to load its postage stamps."})]})]}),t.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--line)",display:"flex",alignItems:"center",justifyContent:"space-between",background:K?"var(--accent-wash)":"var(--bunker)",transition:"background .3s"},children:[t.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,letterSpacing:".06em",color:K?"var(--accent-bright)":"var(--fg-muted)"},children:K?"// fully connected — ready to upload":"// gated · each step unlocks the next"}),K?t.jsxs("span",{style:{display:"inline-flex",gap:4,alignItems:"center",color:"var(--ok)",fontSize:12,fontFamily:"var(--font-mono)"},children:[t.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--ok)",boxShadow:"0 0 8px var(--ok)"}}),"done"]}):t.jsx(Tt,{states:he})]})]})]})}function Yt({beeApiUrl:n=ae,stampMode:r,label:a}){Ge();const[i,s]=m.useState(!1),l=Ne({beeApiUrl:n,stampMode:r}),{beeApiUrl:p,setBeeApiUrl:h,beeNode:d,stamps:o,nodeWallet:u,isFullyConnected:v,address:g}=l,[y,T]=m.useState(!1),I=a??(v&&g?`${g.slice(0,6)}…${g.slice(-4)}`:"Connect to Swarm");return t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:"swarm-connect",onClick:()=>s(!0),onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),style:{display:"inline-flex",alignItems:"center",gap:10,fontFamily:"var(--font-mono)",fontSize:13,fontWeight:600,letterSpacing:".04em",padding:"10px 16px",borderRadius:6,cursor:"pointer",background:v?"var(--ok-wash)":"var(--accent)",color:v?"var(--ok)":"var(--accent-ink)",border:`1px solid ${v?"var(--ok-line)":"transparent"}`,boxShadow:v?"none":y?"0 0 26px var(--accent-glow)":"0 0 14px var(--accent-glow)",transform:y&&!v?"translateY(-1px)":"none",transition:"all .15s var(--ease)",whiteSpace:"nowrap"},children:[v?t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"var(--ok)",boxShadow:"0 0 8px var(--ok)"}}):t.jsx(Gt,{swarm:l}),I]}),i&&t.jsx(Ke,{onClose:()=>s(!1),beeNode:d,stamps:o,beeApiUrl:p,setBeeApiUrl:h,stampMode:l.stampMode,nodeWallet:u})]})}function Gt({swarm:n}){const{beeNode:r,stamps:a,nodeWallet:i,stampMode:s,isWalletConnected:l,isOnGnosis:p,balance:h}=n,d=[l?"ok":"bad",p?"ok":"bad",h.hasGas?"ok":p?"warn":"bad",r.isChecking?"warn":r.isRunning?"ok":"bad",...s==="create"?[i.isFunded?"ok":"bad"]:[],a.selectedStampId?"ok":"bad"],o={ok:"var(--accent-ink)",bad:"rgba(26,14,2,.32)",warn:"#7a4a00"};return t.jsx("span",{style:{display:"inline-flex",gap:4,alignItems:"center"},children:d.map((u,v)=>t.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:o[u],animation:u==="warn"?"sc-pulse-dot 1.4s var(--ease) infinite":"none"}},v))})}const Ht="2.22.1",Vt=()=>`@wagmi/core@${Ht}`;var $e=function(n,r,a,i){if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?n!==r||!i:!r.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?i:a==="a"?i.call(n):i?i.value:r.get(n)},ue,Je;class ce extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Vt()}constructor(r,a={}){var l;super(),ue.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const i=a.cause instanceof ce?a.cause.details:(l=a.cause)!=null&&l.message?a.cause.message:a.details,s=a.cause instanceof ce&&a.cause.docsPath||a.docsPath;this.message=[r||"An error occurred.","",...a.metaMessages?[...a.metaMessages,""]:[],...s?[`Docs: ${this.docsBaseUrl}${s}.html${a.docsSlug?`#${a.docsSlug}`:""}`]:[],...i?[`Details: ${i}`]:[],`Version: ${this.version}`].join(`
|
|
54
|
+
`),a.cause&&(this.cause=a.cause),this.details=i,this.docsPath=s,this.metaMessages=a.metaMessages,this.shortMessage=r}walk(r){return $e(this,ue,"m",Je).call(this,this,r)}}ue=new WeakSet,Je=function n(r,a){return a!=null&&a(r)?r:r.cause?$e(this,ue,"m",n).call(this,r.cause,a):r};class Zt extends ce{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class q extends ce{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function Rn(n){return n}Ce.type="injected";function Ce(n={}){const{shimDisconnect:r=!0,unstable_shimAsyncInject:a}=n;function i(){const d=n.target;if(typeof d=="function"){const o=d();if(o)return o}return typeof d=="object"?d:typeof d=="string"?{...Kt[d]??{id:d,name:`${d[0].toUpperCase()}${d.slice(1)}`,provider:`is${d[0].toUpperCase()}${d.slice(1)}`}}:{id:"injected",name:"Injected",provider(o){return o==null?void 0:o.ethereum}}}let s,l,p,h;return d=>({get icon(){return i().icon},get id(){return i().id},get name(){return i().name},get supportsSimulation(){return!0},type:Ce.type,async setup(){const o=await this.getProvider();o!=null&&o.on&&n.target&&(p||(p=this.onConnect.bind(this),o.on("connect",p)),s||(s=this.onAccountsChanged.bind(this),o.on("accountsChanged",s)))},async connect({chainId:o,isReconnecting:u,withCapabilities:v}={}){var T,I,z,C,k,F;const g=await this.getProvider();if(!g)throw new q;let y=[];if(u)y=await this.getAccounts().catch(()=>[]);else if(r)try{y=(C=(z=(I=(T=(await g.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:T.caveats)==null?void 0:I[0])==null?void 0:z.value)==null?void 0:C.map(j=>_.getAddress(j)),y.length>0&&(y=await this.getAccounts())}catch(R){const j=R;if(j.code===_.UserRejectedRequestError.code)throw new _.UserRejectedRequestError(j);if(j.code===_.ResourceUnavailableRpcError.code)throw j}try{!(y!=null&&y.length)&&!u&&(y=(await g.request({method:"eth_requestAccounts"})).map(A=>_.getAddress(A))),p&&(g.removeListener("connect",p),p=void 0),s||(s=this.onAccountsChanged.bind(this),g.on("accountsChanged",s)),l||(l=this.onChainChanged.bind(this),g.on("chainChanged",l)),h||(h=this.onDisconnect.bind(this),g.on("disconnect",h));let R=await this.getChainId();if(o&&R!==o){const j=await this.switchChain({chainId:o}).catch(A=>{if(A.code===_.UserRejectedRequestError.code)throw A;return{id:R}});R=(j==null?void 0:j.id)??R}return r&&await((k=d.storage)==null?void 0:k.removeItem(`${this.id}.disconnected`)),n.target||await((F=d.storage)==null?void 0:F.setItem("injected.connected",!0)),{accounts:v?y.map(j=>({address:j,capabilities:{}})):y,chainId:R}}catch(R){const j=R;throw j.code===_.UserRejectedRequestError.code?new _.UserRejectedRequestError(j):j.code===_.ResourceUnavailableRpcError.code?new _.ResourceUnavailableRpcError(j):j}},async disconnect(){var u,v;const o=await this.getProvider();if(!o)throw new q;l&&(o.removeListener("chainChanged",l),l=void 0),h&&(o.removeListener("disconnect",h),h=void 0),p||(p=this.onConnect.bind(this),o.on("connect",p));try{await _.withTimeout(()=>o.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}r&&await((u=d.storage)==null?void 0:u.setItem(`${this.id}.disconnected`,!0)),n.target||await((v=d.storage)==null?void 0:v.removeItem("injected.connected"))},async getAccounts(){const o=await this.getProvider();if(!o)throw new q;return(await o.request({method:"eth_accounts"})).map(v=>_.getAddress(v))},async getChainId(){const o=await this.getProvider();if(!o)throw new q;const u=await o.request({method:"eth_chainId"});return Number(u)},async getProvider(){if(typeof window>"u")return;let o;const u=i();return typeof u.provider=="function"?o=u.provider(window):typeof u.provider=="string"?o=fe(window,u.provider):o=u.provider,o&&!o.removeListener&&("off"in o&&typeof o.off=="function"?o.removeListener=o.off:o.removeListener=()=>{}),o},async isAuthorized(){var o,u;try{if(r&&await((o=d.storage)==null?void 0:o.getItem(`${this.id}.disconnected`))||!n.target&&!await((u=d.storage)==null?void 0:u.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(a!==void 0&&a!==!1){const T=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",T),!!await this.getProvider()),I=typeof a=="number"?a:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(C=>window.addEventListener("ethereum#initialized",()=>C(T()),{once:!0}))]:[],new Promise(C=>setTimeout(()=>C(T()),I))]))return!0}throw new q}return!!(await _.withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:u}){var T,I,z,C;const v=await this.getProvider();if(!v)throw new q;const g=d.chains.find(k=>k.id===u);if(!g)throw new _.SwitchChainError(new Zt);const y=new Promise(k=>{const F=R=>{"chainId"in R&&R.chainId===u&&(d.emitter.off("change",F),k())};d.emitter.on("change",F)});try{return await Promise.all([v.request({method:"wallet_switchEthereumChain",params:[{chainId:_.numberToHex(u)}]}).then(async()=>{await this.getChainId()===u&&d.emitter.emit("change",{chainId:u})}),y]),g}catch(k){const F=k;if(F.code===4902||((I=(T=F==null?void 0:F.data)==null?void 0:T.originalError)==null?void 0:I.code)===4902)try{const{default:R,...j}=g.blockExplorers??{};let A;o!=null&&o.blockExplorerUrls?A=o.blockExplorerUrls:R&&(A=[R.url,...Object.values(j).map(Y=>Y.url)]);let N;(z=o==null?void 0:o.rpcUrls)!=null&&z.length?N=o.rpcUrls:N=[((C=g.rpcUrls.default)==null?void 0:C.http[0])??""];const Q={blockExplorerUrls:A,chainId:_.numberToHex(u),chainName:(o==null?void 0:o.chainName)??g.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??g.nativeCurrency,rpcUrls:N};return await Promise.all([v.request({method:"wallet_addEthereumChain",params:[Q]}).then(async()=>{if(await this.getChainId()===u)d.emitter.emit("change",{chainId:u});else throw new _.UserRejectedRequestError(new Error("User rejected switch after adding network."))}),y]),g}catch(R){throw new _.UserRejectedRequestError(R)}throw F.code===_.UserRejectedRequestError.code?new _.UserRejectedRequestError(F):new _.SwitchChainError(F)}},async onAccountsChanged(o){var u;if(o.length===0)this.onDisconnect();else if(d.emitter.listenerCount("connect")){const v=(await this.getChainId()).toString();this.onConnect({chainId:v}),r&&await((u=d.storage)==null?void 0:u.removeItem(`${this.id}.disconnected`))}else d.emitter.emit("change",{accounts:o.map(v=>_.getAddress(v))})},onChainChanged(o){const u=Number(o);d.emitter.emit("change",{chainId:u})},async onConnect(o){const u=await this.getAccounts();if(u.length===0)return;const v=Number(o.chainId);d.emitter.emit("connect",{accounts:u,chainId:v});const g=await this.getProvider();g&&(p&&(g.removeListener("connect",p),p=void 0),s||(s=this.onAccountsChanged.bind(this),g.on("accountsChanged",s)),l||(l=this.onChainChanged.bind(this),g.on("chainChanged",l)),h||(h=this.onDisconnect.bind(this),g.on("disconnect",h)))},async onDisconnect(o){const u=await this.getProvider();o&&o.code===1013&&u&&(await this.getAccounts()).length||(d.emitter.emit("disconnect"),u&&(l&&(u.removeListener("chainChanged",l),l=void 0),h&&(u.removeListener("disconnect",h),h=void 0),p||(p=this.onConnect.bind(this),u.on("connect",p))))}})}const Kt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(n){return n!=null&&n.coinbaseWalletExtension?n.coinbaseWalletExtension:fe(n,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(n){return fe(n,r=>{if(!r.isMetaMask||r.isBraveWallet&&!r._events&&!r._state)return!1;const a=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const i of a)if(r[i])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(n){var r,a;return(r=n==null?void 0:n.phantom)!=null&&r.ethereum?(a=n.phantom)==null?void 0:a.ethereum:fe(n,"isPhantom")}}};function fe(n,r){function a(s){return typeof r=="function"?r(s):typeof r=="string"?s[r]:!0}const i=n.ethereum;if(i!=null&&i.providers)return i.providers.find(s=>a(s));if(i&&a(i))return i}const $t=new Oe.QueryClient,Jt=O.createConfig({chains:[ke],connectors:[Ce()],transports:{[ke.id]:O.http()}});function Xt({children:n}){return t.jsx(O.WagmiProvider,{config:Jt,children:t.jsx(Oe.QueryClientProvider,{client:$t,children:n})})}L.SwarmConnectButton=Yt,L.SwarmConnectModal=Ke,L.SwarmConnectProvider=Xt,L.useBeeNode=Me,L.useNodeWallet=ye,L.usePostageStamps=Ue,L.useSwarmConnect=Ne,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design tokens + keyframes for the Swarm Connect widget.
|
|
3
|
+
*
|
|
4
|
+
* Tokens are scoped to the `.swarm-connect` class so they don't leak globally;
|
|
5
|
+
* the button, modal backdrop and dialog all carry that class, and every inner
|
|
6
|
+
* element reads the values via `var(--…)` inheritance. Keyframes are prefixed
|
|
7
|
+
* `sc-` to avoid clashing with a host app's animations.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SWARM_CSS = "\n.swarm-connect {\n --void:#060809; --bunker:#0b0f12; --surface:#121821; --raised:#18202b; --raised-2:#1e2833;\n --line:rgba(255,255,255,0.07); --line-2:rgba(255,255,255,0.12); --line-orange:rgba(255,107,0,0.45);\n --fg:#f3f5f7; --fg-soft:#c3cad3; --fg-muted:#7d8794; --fg-faint:#565f6b;\n --accent:#ff6b00; --accent-bright:#ff8a33; --accent-deep:#d65500; --accent-ink:#1a0e02;\n --accent-glow:rgba(255,107,0,0.40); --accent-wash:rgba(255,107,0,0.10);\n --ok:#36c46a; --ok-wash:rgba(54,196,106,0.12); --ok-line:rgba(54,196,106,0.40);\n --bad:#ff5640; --bad-wash:rgba(255,86,64,0.12); --bad-line:rgba(255,86,64,0.38);\n --warn:#f0a83a; --warn-wash:rgba(240,168,58,0.12); --warn-line:rgba(240,168,58,0.40);\n --font-display:'Space Grotesk',system-ui,sans-serif;\n --font-body:'Inter',system-ui,sans-serif;\n --font-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;\n --ease:cubic-bezier(0.22,0.61,0.36,1);\n}\n@keyframes sc-spin { to { transform: rotate(360deg); } }\n@keyframes sc-pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(.82); } }\n@keyframes sc-modal-in { from { opacity:0; transform:translate(-50%, calc(-50% + 10px)) scale(.985); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }\n@keyframes sc-backdrop-in { from { opacity:0; } to { opacity:1; } }\n@keyframes sc-step-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }\n.sc-scroll::-webkit-scrollbar { width:8px; }\n.sc-scroll::-webkit-scrollbar-thumb { background:var(--line-2); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }\n.sc-scroll::-webkit-scrollbar-track { background:transparent; }\n";
|
|
10
|
+
/** Injects {@link SWARM_CSS} into <head> exactly once per document. */
|
|
11
|
+
export declare function ensureSwarmStyles(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'select' — the dApp only uses postage stamps the user already owns.
|
|
3
|
+
* 'create' — the dApp can buy stamps too, which needs the Bee node's own
|
|
4
|
+
* wallet funded with xDAI + xBZZ (a one-time setup step shown in the modal).
|
|
5
|
+
*/
|
|
6
|
+
export type StampMode = 'select' | 'create';
|
|
1
7
|
export interface SwarmConnectConfig {
|
|
2
8
|
beeApiUrl?: string;
|
|
9
|
+
/** Defaults to 'select' so no on-chain spending is required to connect. */
|
|
10
|
+
stampMode?: StampMode;
|
|
3
11
|
}
|
|
4
12
|
export interface BeeNodeStatus {
|
|
5
13
|
isRunning: boolean;
|
|
@@ -20,6 +28,13 @@ export interface PostageStamp {
|
|
|
20
28
|
exists: boolean;
|
|
21
29
|
batchTTL: number;
|
|
22
30
|
}
|
|
31
|
+
export interface CreateStampOptions {
|
|
32
|
+
/** PLUR per chunk; TTL grows with amount. */
|
|
33
|
+
amount: string;
|
|
34
|
+
/** Batch depth (capacity = 2^depth chunks); bee requires ≥ 17. */
|
|
35
|
+
depth: number;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
23
38
|
export interface PostageStampsState {
|
|
24
39
|
stamps: PostageStamp[];
|
|
25
40
|
isLoading: boolean;
|
|
@@ -27,6 +42,30 @@ export interface PostageStampsState {
|
|
|
27
42
|
fetchStamps: () => void;
|
|
28
43
|
selectedStampId?: string;
|
|
29
44
|
selectStamp: (id: string) => void;
|
|
45
|
+
/** Buys a stamp via the node (POST /stamps); resolves to the new batch ID. */
|
|
46
|
+
createStamp: (options: CreateStampOptions) => Promise<string | undefined>;
|
|
47
|
+
isCreating: boolean;
|
|
48
|
+
createError?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface BalanceState {
|
|
51
|
+
/** Native xDAI balance on Gnosis, in ether units (undefined until loaded). */
|
|
52
|
+
xdai?: number;
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
/** True when connected, on Gnosis, and the xDAI balance is greater than zero. */
|
|
55
|
+
hasGas: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface NodeWalletState {
|
|
58
|
+
/** The Bee node's own Ethereum address (from /addresses). */
|
|
59
|
+
address?: string;
|
|
60
|
+
/** Node wallet xDAI balance, in ether units (undefined until loaded). */
|
|
61
|
+
xdai?: number;
|
|
62
|
+
/** Node wallet xBZZ balance, in token units (undefined until loaded). */
|
|
63
|
+
xbzz?: number;
|
|
64
|
+
isLoading: boolean;
|
|
65
|
+
error?: string;
|
|
66
|
+
/** True once the node wallet holds both xDAI and xBZZ — it can buy stamps. */
|
|
67
|
+
isFunded: boolean;
|
|
68
|
+
refresh: () => void;
|
|
30
69
|
}
|
|
31
70
|
export interface SwarmConnectState {
|
|
32
71
|
beeNode: BeeNodeStatus & {
|
|
@@ -35,9 +74,12 @@ export interface SwarmConnectState {
|
|
|
35
74
|
stamps: PostageStampsState;
|
|
36
75
|
beeApiUrl: string;
|
|
37
76
|
setBeeApiUrl: (url: string) => void;
|
|
77
|
+
stampMode: StampMode;
|
|
78
|
+
nodeWallet: NodeWalletState;
|
|
38
79
|
isWalletConnected: boolean;
|
|
39
80
|
address?: string;
|
|
40
81
|
isOnGnosis: boolean;
|
|
41
82
|
chainId?: number;
|
|
83
|
+
balance: BalanceState;
|
|
42
84
|
isFullyConnected: boolean;
|
|
43
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ffaerber/swarm-connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React connect-button wizard for Ethereum Swarm on Gnosis chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,10 +35,13 @@
|
|
|
35
35
|
"require": "./dist/swarm-connect.umd.cjs"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"files": [
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
39
41
|
"scripts": {
|
|
40
42
|
"build": "vite build && tsc --emitDeclarationOnly --declaration --declarationDir dist",
|
|
41
43
|
"dev": "vite",
|
|
44
|
+
"dev:poll": "VITE_USE_POLLING=true vite",
|
|
42
45
|
"type-check": "tsc --noEmit",
|
|
43
46
|
"prepublishOnly": "npm run build"
|
|
44
47
|
},
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface StepLabelProps {
|
|
2
|
-
step: number;
|
|
3
|
-
done?: boolean;
|
|
4
|
-
children: string;
|
|
5
|
-
}
|
|
6
|
-
/** Numbered section heading that signals the setup sequence (1 → 2 → 3). */
|
|
7
|
-
export declare function StepLabel({ step, done, children }: StepLabelProps): import("react").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BeeNodeStatus, PostageStampsState } from '../../types';
|
|
2
|
-
interface SwarmSectionProps {
|
|
3
|
-
beeApiUrl: string;
|
|
4
|
-
setBeeApiUrl: (url: string) => void;
|
|
5
|
-
beeNode: BeeNodeStatus & {
|
|
6
|
-
check: () => void;
|
|
7
|
-
};
|
|
8
|
-
stamps: PostageStampsState;
|
|
9
|
-
}
|
|
10
|
-
export declare function SwarmSection({ beeApiUrl, setBeeApiUrl, beeNode, stamps }: SwarmSectionProps): import("react").JSX.Element;
|
|
11
|
-
export {};
|