@dcl/governance-site 1.15.1-20473093943.commit-ad8dc42 → 2.0.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/assets/{UserAvatar-41371133.js → UserAvatar-78751cb5.js} +1 -1
- package/assets/{basic-de12c849.js → basic-ca749c4c.js} +1 -1
- package/assets/{core-0c13d1dd.js → core-806d78ea.js} +7 -7
- package/assets/{features-e842dc9f.js → features-b72c9430.js} +1 -1
- package/assets/{fortmatic-dbae6d9f.js → fortmatic-12e0f2e5.js} +1 -1
- package/assets/{index-2a49049d.js → index-073512a1.js} +1 -1
- package/assets/{index-726bc846.js → index-2ef9f1d1.js} +14 -14
- package/assets/{index-bc60e460.js → index-372705ba.js} +1 -1
- package/assets/{index-6dad6f13.js → index-4be588a0.js} +1 -1
- package/assets/{index-37d53923.js → index-74e34dfb.js} +2 -2
- package/assets/{index-a5cbd387.css → index-a8255d1c.css} +4 -4
- package/assets/{index-16e232ba.js → index-bbb36593.js} +1 -1
- package/assets/{index-c2e969f4.js → index-c1c8440f.js} +1 -1
- package/assets/{tslib.es6-1071ccd0.js → tslib.es6-82b9ba96.js} +1 -1
- package/assets/{w3m-modal-d813356f.js → w3m-modal-26eff9d9.js} +1 -1
- package/index.html +4 -4
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as Cf,g as u_}from"./index-
|
|
1
|
+
import{h as Cf,g as u_}from"./index-2ef9f1d1.js";var Yu={},_n={},vn={},qf;function d_(){return qf||(qf=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.version=void 0,vn.version="1.2.3"),vn}var Mf;function an(){if(Mf)return _n;Mf=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.BaseError=void 0;const e=d_();class r extends Error{constructor(t,i={}){var c;const s=i.cause instanceof r?i.cause.details:(c=i.cause)!=null&&c.message?i.cause.message:i.details,o=i.cause instanceof r&&i.cause.docsPath||i.docsPath,a=[t||"An error occurred.","",...i.metaMessages?[...i.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${e.version}`].join(`
|
|
2
2
|
`);super(a),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:"AbiTypeError"}),i.cause&&(this.cause=i.cause),this.details=s,this.docsPath=o,this.metaMessages=i.metaMessages,this.shortMessage=t}}return _n.BaseError=r,_n}var Do={},Hf;function f_(){if(Hf)return Do;Hf=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.narrow=e;function e(r){return r}return Do}var Go={},Vo={},Wo={},Ko={},Tt={},Ff;function nu(){if(Ff)return Tt;Ff=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.isTupleRegex=Tt.integerRegex=Tt.bytesRegex=void 0,Tt.execTyped=e;function e(r,n){const t=r.exec(n);return t==null?void 0:t.groups}return Tt.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Tt.integerRegex=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Tt.isTupleRegex=/^\(.+?\).*?$/,Tt}var kf;function Wh(){if(kf)return Ko;kf=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.formatAbiParameter=n;const e=nu(),r=/^tuple(?<array>(\[(\d*)\])*)$/;function n(t){let i=t.type;if(r.test(t.type)&&"components"in t){i="(";const s=t.components.length;for(let a=0;a<s;a++){const c=t.components[a];i+=n(c),a<s-1&&(i+=", ")}const o=(0,e.execTyped)(r,t.type);return i+=`)${(o==null?void 0:o.array)||""}`,n({...t,type:i})}return"indexed"in t&&t.indexed&&(i=`${i} indexed`),t.name?`${i} ${t.name}`:i}return Ko}var Nf;function Kh(){if(Nf)return Wo;Nf=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.formatAbiParameters=r;const e=Wh();function r(n){let t="";const i=n.length;for(let s=0;s<i;s++){const o=n[s];t+=(0,e.formatAbiParameter)(o),s!==i-1&&(t+=", ")}return t}return Wo}var $f;function Zh(){if($f)return Vo;$f=1,Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.formatAbiItem=r;const e=Kh();function r(n){var t;return n.type==="function"?`function ${n.name}(${(0,e.formatAbiParameters)(n.inputs)})${n.stateMutability&&n.stateMutability!=="nonpayable"?` ${n.stateMutability}`:""}${(t=n.outputs)!=null&&t.length?` returns (${(0,e.formatAbiParameters)(n.outputs)})`:""}`:n.type==="event"?`event ${n.name}(${(0,e.formatAbiParameters)(n.inputs)})`:n.type==="error"?`error ${n.name}(${(0,e.formatAbiParameters)(n.inputs)})`:n.type==="constructor"?`constructor(${(0,e.formatAbiParameters)(n.inputs)})${n.stateMutability==="payable"?" payable":""}`:n.type==="fallback"?`fallback() external${n.stateMutability==="payable"?" payable":""}`:"receive() external payable"}return Vo}var zf;function l_(){if(zf)return Go;zf=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.formatAbi=r;const e=Zh();function r(n){const t=[],i=n.length;for(let s=0;s<i;s++){const o=n[s],a=(0,e.formatAbiItem)(o);t.push(a)}return t}return Go}var Zo={},Se={},Uf;function sn(){if(Uf)return Se;Uf=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.functionModifiers=Se.eventModifiers=Se.modifiers=void 0,Se.isErrorSignature=n,Se.execErrorSignature=t,Se.isEventSignature=s,Se.execEventSignature=o,Se.isFunctionSignature=c,Se.execFunctionSignature=d,Se.isStructSignature=f,Se.execStructSignature=m,Se.isConstructorSignature=h,Se.execConstructorSignature=b,Se.isFallbackSignature=j,Se.execFallbackSignature=g,Se.isReceiveSignature=u;const e=nu(),r=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function n(E){return r.test(E)}function t(E){return(0,e.execTyped)(r,E)}const i=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function s(E){return i.test(E)}function o(E){return(0,e.execTyped)(i,E)}const a=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function c(E){return a.test(E)}function d(E){return(0,e.execTyped)(a,E)}const l=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function f(E){return l.test(E)}function m(E){return(0,e.execTyped)(l,E)}const v=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function h(E){return v.test(E)}function b(E){return(0,e.execTyped)(v,E)}const _=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function j(E){return _.test(E)}function g(E){return(0,e.execTyped)(_,E)}const P=/^receive\(\) external payable$/;function u(E){return P.test(E)}return Se.modifiers=new Set(["memory","indexed","storage","calldata"]),Se.eventModifiers=new Set(["indexed"]),Se.functionModifiers=new Set(["calldata","memory","storage"]),Se}var Yo={},Rt={},Lf;function ou(){if(Lf)return Rt;Lf=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.UnknownSolidityTypeError=Rt.UnknownTypeError=Rt.InvalidAbiItemError=void 0;const e=an();class r extends e.BaseError{constructor({signature:s}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(s,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}Rt.InvalidAbiItemError=r;class n extends e.BaseError{constructor({type:s}){super("Unknown type.",{metaMessages:[`Type "${s}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}Rt.UnknownTypeError=n;class t extends e.BaseError{constructor({type:s}){super("Unknown type.",{metaMessages:[`Type "${s}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}return Rt.UnknownSolidityTypeError=t,Rt}var Fe={},Df;function lo(){if(Df)return Fe;Df=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.InvalidAbiTypeParameterError=Fe.InvalidFunctionModifierError=Fe.InvalidModifierError=Fe.SolidityProtectedKeywordError=Fe.InvalidParameterError=Fe.InvalidAbiParametersError=Fe.InvalidAbiParameterError=void 0;const e=an();class r extends e.BaseError{constructor({param:d}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(d,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}}Fe.InvalidAbiParameterError=r;class n extends e.BaseError{constructor({params:d}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(d,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}Fe.InvalidAbiParametersError=n;class t extends e.BaseError{constructor({param:d}){super("Invalid ABI parameter.",{details:d}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}Fe.InvalidParameterError=t;class i extends e.BaseError{constructor({param:d,name:l}){super("Invalid ABI parameter.",{details:d,metaMessages:[`"${l}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}Fe.SolidityProtectedKeywordError=i;class s extends e.BaseError{constructor({param:d,type:l,modifier:f}){super("Invalid ABI parameter.",{details:d,metaMessages:[`Modifier "${f}" not allowed${l?` in "${l}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}Fe.InvalidModifierError=s;class o extends e.BaseError{constructor({param:d,type:l,modifier:f}){super("Invalid ABI parameter.",{details:d,metaMessages:[`Modifier "${f}" not allowed${l?` in "${l}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${f}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}Fe.InvalidFunctionModifierError=o;class a extends e.BaseError{constructor({abiParameter:d}){super("Invalid ABI parameter.",{details:JSON.stringify(d,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}return Fe.InvalidAbiTypeParameterError=a,Fe}var Ot={},Gf;function wd(){if(Gf)return Ot;Gf=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.InvalidStructSignatureError=Ot.UnknownSignatureError=Ot.InvalidSignatureError=void 0;const e=an();class r extends e.BaseError{constructor({signature:s,type:o}){super(`Invalid ${o} signature.`,{details:s}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}Ot.InvalidSignatureError=r;class n extends e.BaseError{constructor({signature:s}){super("Unknown signature.",{details:s}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}Ot.UnknownSignatureError=n;class t extends e.BaseError{constructor({signature:s}){super("Invalid struct signature.",{details:s,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}return Ot.InvalidStructSignatureError=t,Ot}var En={},Vf;function Yh(){if(Vf)return En;Vf=1,Object.defineProperty(En,"__esModule",{value:!0}),En.CircularReferenceError=void 0;const e=an();class r extends e.BaseError{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}return En.CircularReferenceError=r,En}var Ke={},jn={},Wf;function Jh(){if(Wf)return jn;Wf=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.InvalidParenthesisError=void 0;const e=an();class r extends e.BaseError{constructor({current:t,depth:i}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${i>0?"opening":"closing"} parentheses.`],details:`Depth "${i}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}return jn.InvalidParenthesisError=r,jn}var Nr={},Kf;function b_(){if(Kf)return Nr;Kf=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.parameterCache=void 0,Nr.getParameterCacheKey=e;function e(r,n,t){let i="";if(t)for(const s of Object.entries(t)){if(!s)continue;let o="";for(const a of s[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;i+=`(${s[0]}{${o}})`}return n?`${n}:${r}${i}`:`${r}${i}`}return Nr.parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),Nr}var Zf;function on(){if(Zf)return Ke;Zf=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.parseSignature=a,Ke.parseFunctionSignature=c,Ke.parseEventSignature=d,Ke.parseErrorSignature=l,Ke.parseConstructorSignature=f,Ke.parseFallbackSignature=m,Ke.parseAbiParameter=_,Ke.splitParameters=j,Ke.isSolidityType=g,Ke.isSolidityKeyword=u,Ke.isValidDataLocation=E;const e=nu(),r=ou(),n=lo(),t=wd(),i=Jh(),s=b_(),o=sn();function a(p,y={}){if((0,o.isFunctionSignature)(p))return c(p,y);if((0,o.isEventSignature)(p))return d(p,y);if((0,o.isErrorSignature)(p))return l(p,y);if((0,o.isConstructorSignature)(p))return f(p,y);if((0,o.isFallbackSignature)(p))return m(p);if((0,o.isReceiveSignature)(p))return{type:"receive",stateMutability:"payable"};throw new t.UnknownSignatureError({signature:p})}function c(p,y={}){const A=(0,o.execFunctionSignature)(p);if(!A)throw new t.InvalidSignatureError({signature:p,type:"function"});const w=j(A.parameters),T=[],O=w.length;for(let S=0;S<O;S++)T.push(_(w[S],{modifiers:o.functionModifiers,structs:y,type:"function"}));const B=[];if(A.returns){const S=j(A.returns),x=S.length;for(let k=0;k<x;k++)B.push(_(S[k],{modifiers:o.functionModifiers,structs:y,type:"function"}))}return{name:A.name,type:"function",stateMutability:A.stateMutability??"nonpayable",inputs:T,outputs:B}}function d(p,y={}){const A=(0,o.execEventSignature)(p);if(!A)throw new t.InvalidSignatureError({signature:p,type:"event"});const w=j(A.parameters),T=[],O=w.length;for(let B=0;B<O;B++)T.push(_(w[B],{modifiers:o.eventModifiers,structs:y,type:"event"}));return{name:A.name,type:"event",inputs:T}}function l(p,y={}){const A=(0,o.execErrorSignature)(p);if(!A)throw new t.InvalidSignatureError({signature:p,type:"error"});const w=j(A.parameters),T=[],O=w.length;for(let B=0;B<O;B++)T.push(_(w[B],{structs:y,type:"error"}));return{name:A.name,type:"error",inputs:T}}function f(p,y={}){const A=(0,o.execConstructorSignature)(p);if(!A)throw new t.InvalidSignatureError({signature:p,type:"constructor"});const w=j(A.parameters),T=[],O=w.length;for(let B=0;B<O;B++)T.push(_(w[B],{structs:y,type:"constructor"}));return{type:"constructor",stateMutability:A.stateMutability??"nonpayable",inputs:T}}function m(p){const y=(0,o.execFallbackSignature)(p);if(!y)throw new t.InvalidSignatureError({signature:p,type:"fallback"});return{type:"fallback",stateMutability:y.stateMutability??"nonpayable"}}const v=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,h=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,b=/^u?int$/;function _(p,y){var I,F;const A=(0,s.getParameterCacheKey)(p,y==null?void 0:y.type,y==null?void 0:y.structs);if(s.parameterCache.has(A))return s.parameterCache.get(A);const w=e.isTupleRegex.test(p),T=(0,e.execTyped)(w?h:v,p);if(!T)throw new n.InvalidParameterError({param:p});if(T.name&&u(T.name))throw new n.SolidityProtectedKeywordError({param:p,name:T.name});const O=T.name?{name:T.name}:{},B=T.modifier==="indexed"?{indexed:!0}:{},S=(y==null?void 0:y.structs)??{};let x,k={};if(w){x="tuple";const R=j(T.type),q=[],M=R.length;for(let H=0;H<M;H++)q.push(_(R[H],{structs:S}));k={components:q}}else if(T.type in S)x="tuple",k={components:S[T.type]};else if(b.test(T.type))x=`${T.type}256`;else if(T.type==="address payable")x="address";else if(x=T.type,(y==null?void 0:y.type)!=="struct"&&!g(x))throw new r.UnknownSolidityTypeError({type:x});if(T.modifier){if(!((F=(I=y==null?void 0:y.modifiers)==null?void 0:I.has)!=null&&F.call(I,T.modifier)))throw new n.InvalidModifierError({param:p,type:y==null?void 0:y.type,modifier:T.modifier});if(o.functionModifiers.has(T.modifier)&&!E(x,!!T.array))throw new n.InvalidFunctionModifierError({param:p,type:y==null?void 0:y.type,modifier:T.modifier})}const C={type:`${x}${T.array??""}`,...O,...B,...k};return s.parameterCache.set(A,C),C}function j(p,y=[],A="",w=0){const T=p.trim().length;for(let O=0;O<T;O++){const B=p[O],S=p.slice(O+1);switch(B){case",":return w===0?j(S,[...y,A.trim()]):j(S,y,`${A}${B}`,w);case"(":return j(S,y,`${A}${B}`,w+1);case")":return j(S,y,`${A}${B}`,w-1);default:return j(S,y,`${A}${B}`,w)}}if(A==="")return y;if(w!==0)throw new i.InvalidParenthesisError({current:A,depth:w});return y.push(A.trim()),y}function g(p){return p==="address"||p==="bool"||p==="function"||p==="string"||e.bytesRegex.test(p)||e.integerRegex.test(p)}const P=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function u(p){return p==="address"||p==="bool"||p==="function"||p==="string"||p==="tuple"||e.bytesRegex.test(p)||e.integerRegex.test(p)||P.test(p)}function E(p,y){return y||p==="bytes"||p==="string"||p==="tuple"}return Ke}var Yf;function iu(){if(Yf)return Yo;Yf=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.parseStructs=a;const e=nu(),r=ou(),n=lo(),t=wd(),i=Yh(),s=sn(),o=on();function a(l){const f={},m=l.length;for(let _=0;_<m;_++){const j=l[_];if(!(0,s.isStructSignature)(j))continue;const g=(0,s.execStructSignature)(j);if(!g)throw new t.InvalidSignatureError({signature:j,type:"struct"});const P=g.properties.split(";"),u=[],E=P.length;for(let p=0;p<E;p++){const A=P[p].trim();if(!A)continue;const w=(0,o.parseAbiParameter)(A,{type:"struct"});u.push(w)}if(!u.length)throw new t.InvalidStructSignatureError({signature:j});f[g.name]=u}const v={},h=Object.entries(f),b=h.length;for(let _=0;_<b;_++){const[j,g]=h[_];v[j]=d(g,f)}return v}const c=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function d(l=[],f={},m=new Set){const v=[],h=l.length;for(let b=0;b<h;b++){const _=l[b];if(e.isTupleRegex.test(_.type))v.push(_);else{const g=(0,e.execTyped)(c,_.type);if(!(g!=null&&g.type))throw new n.InvalidAbiTypeParameterError({abiParameter:_});const{array:P,type:u}=g;if(u in f){if(m.has(u))throw new i.CircularReferenceError({type:u});v.push({..._,type:`tuple${P??""}`,components:d(f[u],f,new Set([...m,u]))})}else if((0,o.isSolidityType)(u))v.push(_);else throw new r.UnknownTypeError({type:u})}}return v}return Yo}var Jf;function m_(){if(Jf)return Zo;Jf=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.parseAbi=t;const e=sn(),r=iu(),n=on();function t(i){const s=(0,r.parseStructs)(i),o=[],a=i.length;for(let c=0;c<a;c++){const d=i[c];(0,e.isStructSignature)(d)||o.push((0,n.parseSignature)(d,s))}return o}return Zo}var Jo={},Xf;function y_(){if(Xf)return Jo;Xf=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.parseAbiItem=i;const e=ou(),r=sn(),n=iu(),t=on();function i(s){let o;if(typeof s=="string")o=(0,t.parseSignature)(s);else{const a=(0,n.parseStructs)(s),c=s.length;for(let d=0;d<c;d++){const l=s[d];if(!(0,r.isStructSignature)(l)){o=(0,t.parseSignature)(l,a);break}}}if(!o)throw new e.InvalidAbiItemError({signature:s});return o}return Jo}var Xo={},Qf;function h_(){if(Qf)return Xo;Qf=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.parseAbiParameter=i;const e=lo(),r=sn(),n=iu(),t=on();function i(s){let o;if(typeof s=="string")o=(0,t.parseAbiParameter)(s,{modifiers:r.modifiers});else{const a=(0,n.parseStructs)(s),c=s.length;for(let d=0;d<c;d++){const l=s[d];if(!(0,r.isStructSignature)(l)){o=(0,t.parseAbiParameter)(l,{modifiers:r.modifiers,structs:a});break}}}if(!o)throw new e.InvalidAbiParameterError({param:s});return o}return Xo}var Qo={},e0;function p_(){if(e0)return Qo;e0=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.parseAbiParameters=s;const e=lo(),r=sn(),n=iu(),t=on(),i=on();function s(o){const a=[];if(typeof o=="string"){const c=(0,t.splitParameters)(o),d=c.length;for(let l=0;l<d;l++)a.push((0,i.parseAbiParameter)(c[l],{modifiers:r.modifiers}))}else{const c=(0,n.parseStructs)(o),d=o.length;for(let l=0;l<d;l++){const f=o[l];if((0,r.isStructSignature)(f))continue;const m=(0,t.splitParameters)(f),v=m.length;for(let h=0;h<v;h++)a.push((0,i.parseAbiParameter)(m[h],{modifiers:r.modifiers,structs:c}))}}if(a.length===0)throw new e.InvalidAbiParametersError({params:o});return a}return Qo}var t0;function tr(){return t0||(t0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CircularReferenceError=e.InvalidParenthesisError=e.UnknownSignatureError=e.InvalidSignatureError=e.InvalidStructSignatureError=e.InvalidAbiParameterError=e.InvalidAbiParametersError=e.InvalidParameterError=e.SolidityProtectedKeywordError=e.InvalidModifierError=e.InvalidFunctionModifierError=e.InvalidAbiTypeParameterError=e.UnknownSolidityTypeError=e.InvalidAbiItemError=e.UnknownTypeError=e.parseAbiParameters=e.parseAbiParameter=e.parseAbiItem=e.parseAbi=e.formatAbiParameters=e.formatAbiParameter=e.formatAbiItem=e.formatAbi=e.narrow=e.BaseError=void 0;var r=an();Object.defineProperty(e,"BaseError",{enumerable:!0,get:function(){return r.BaseError}});var n=f_();Object.defineProperty(e,"narrow",{enumerable:!0,get:function(){return n.narrow}});var t=l_();Object.defineProperty(e,"formatAbi",{enumerable:!0,get:function(){return t.formatAbi}});var i=Zh();Object.defineProperty(e,"formatAbiItem",{enumerable:!0,get:function(){return i.formatAbiItem}});var s=Wh();Object.defineProperty(e,"formatAbiParameter",{enumerable:!0,get:function(){return s.formatAbiParameter}});var o=Kh();Object.defineProperty(e,"formatAbiParameters",{enumerable:!0,get:function(){return o.formatAbiParameters}});var a=m_();Object.defineProperty(e,"parseAbi",{enumerable:!0,get:function(){return a.parseAbi}});var c=y_();Object.defineProperty(e,"parseAbiItem",{enumerable:!0,get:function(){return c.parseAbiItem}});var d=h_();Object.defineProperty(e,"parseAbiParameter",{enumerable:!0,get:function(){return d.parseAbiParameter}});var l=p_();Object.defineProperty(e,"parseAbiParameters",{enumerable:!0,get:function(){return l.parseAbiParameters}});var f=ou();Object.defineProperty(e,"UnknownTypeError",{enumerable:!0,get:function(){return f.UnknownTypeError}}),Object.defineProperty(e,"InvalidAbiItemError",{enumerable:!0,get:function(){return f.InvalidAbiItemError}}),Object.defineProperty(e,"UnknownSolidityTypeError",{enumerable:!0,get:function(){return f.UnknownSolidityTypeError}});var m=lo();Object.defineProperty(e,"InvalidAbiTypeParameterError",{enumerable:!0,get:function(){return m.InvalidAbiTypeParameterError}}),Object.defineProperty(e,"InvalidFunctionModifierError",{enumerable:!0,get:function(){return m.InvalidFunctionModifierError}}),Object.defineProperty(e,"InvalidModifierError",{enumerable:!0,get:function(){return m.InvalidModifierError}}),Object.defineProperty(e,"SolidityProtectedKeywordError",{enumerable:!0,get:function(){return m.SolidityProtectedKeywordError}}),Object.defineProperty(e,"InvalidParameterError",{enumerable:!0,get:function(){return m.InvalidParameterError}}),Object.defineProperty(e,"InvalidAbiParametersError",{enumerable:!0,get:function(){return m.InvalidAbiParametersError}}),Object.defineProperty(e,"InvalidAbiParameterError",{enumerable:!0,get:function(){return m.InvalidAbiParameterError}});var v=wd();Object.defineProperty(e,"InvalidStructSignatureError",{enumerable:!0,get:function(){return v.InvalidStructSignatureError}}),Object.defineProperty(e,"InvalidSignatureError",{enumerable:!0,get:function(){return v.InvalidSignatureError}}),Object.defineProperty(e,"UnknownSignatureError",{enumerable:!0,get:function(){return v.UnknownSignatureError}});var h=Jh();Object.defineProperty(e,"InvalidParenthesisError",{enumerable:!0,get:function(){return h.InvalidParenthesisError}});var b=Yh();Object.defineProperty(e,"CircularReferenceError",{enumerable:!0,get:function(){return b.CircularReferenceError}})}(Yu)),Yu}var wn={},r0;function Xh(){if(r0)return wn;r0=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.defineChain=e,wn.extendSchema=r;function e(n){const t={formatters:void 0,fees:void 0,serializers:void 0,...n};function i(s){return o=>{const a=typeof o=="function"?o(s):o,c={...s,...a};return Object.assign(c,{extend:i(c)})}}return Object.assign(t,{extend:i(t)})}function r(){return{}}return wn}var xt={},tt={},$r={},Pn={},n0;function g_(){return n0||(n0=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.version=void 0,Pn.version="2.43.3"),Pn}var o0;function ue(){if(o0)return $r;o0=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.BaseError=void 0,$r.setErrorConfig=n;const e=g_();let r={getDocsUrl:({docsBaseUrl:s,docsPath:o="",docsSlug:a})=>o?`${s??"https://viem.sh"}${o}${a?`#${a}`:""}`:void 0,version:`viem@${e.version}`};function n(s){r=s}class t extends Error{constructor(o,a={}){var m;const c=(()=>{var v;return a.cause instanceof t?a.cause.details:(v=a.cause)!=null&&v.message?a.cause.message:a.details})(),d=(()=>a.cause instanceof t&&a.cause.docsPath||a.docsPath)(),l=(m=r.getDocsUrl)==null?void 0:m.call(r,{...a,docsPath:d}),f=[o||"An error occurred.","",...a.metaMessages?[...a.metaMessages,""]:[],...l?[`Docs: ${l}`]:[],...c?[`Details: ${c}`]:[],...r.version?[`Version: ${r.version}`]:[]].join(`
|
|
3
3
|
`);super(f,a.cause?{cause:a.cause}:void 0),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,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=c,this.docsPath=d,this.metaMessages=a.metaMessages,this.name=a.name??this.name,this.shortMessage=o,this.version=e.version}walk(o){return i(this,o)}}$r.BaseError=t;function i(s,o){return o!=null&&o(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?i(s.cause,o):o?null:s}return $r}var i0;function cn(){if(i0)return tt;i0=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.SizeOverflowError=tt.InvalidHexValueError=tt.InvalidHexBooleanError=tt.InvalidBytesBooleanError=tt.IntegerOutOfRangeError=void 0;const e=ue();class r extends e.BaseError{constructor({max:a,min:c,signed:d,size:l,value:f}){super(`Number "${f}" is not in safe ${l?`${l*8}-bit ${d?"signed":"unsigned"} `:""}integer range ${a?`(${c} to ${a})`:`(above ${c})`}`,{name:"IntegerOutOfRangeError"})}}tt.IntegerOutOfRangeError=r;class n extends e.BaseError{constructor(a){super(`Bytes value "${a}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}tt.InvalidBytesBooleanError=n;class t extends e.BaseError{constructor(a){super(`Hex value "${a}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}tt.InvalidHexBooleanError=t;class i extends e.BaseError{constructor(a){super(`Hex value "${a}" is an odd length (${a.length}). It must be an even length.`,{name:"InvalidHexValueError"})}}tt.InvalidHexValueError=i;class s extends e.BaseError{constructor({givenSize:a,maxSize:c}){super(`Size cannot exceed ${c} bytes. Given size: ${a} bytes.`,{name:"SizeOverflowError"})}}return tt.SizeOverflowError=s,tt}var ei={},ti={},a0;function Ge(){if(a0)return ti;a0=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.isHex=e;function e(r,{strict:n=!0}={}){return!r||typeof r!="string"?!1:n?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}return ti}var s0;function Ye(){if(s0)return ei;s0=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.size=r;const e=Ge();function r(n){return(0,e.isHex)(n,{strict:!1})?Math.ceil((n.length-2)/2):n.length}return ei}var ri={},c0;function Ut(){if(c0)return ri;c0=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.trim=e;function e(r,{dir:n="left"}={}){let t=typeof r=="string"?r.replace("0x",""):r,i=0;for(let s=0;s<t.length-1&&t[n==="left"?s:t.length-s-1].toString()==="0";s++)i++;return t=n==="left"?t.slice(i):t.slice(0,t.length-i),typeof r=="string"?(t.length===1&&n==="right"&&(t=`${t}0`),`0x${t.length%2===1?`0${t}`:t}`):t}return ri}var Kt={},zr={},Ct={},u0;function au(){if(u0)return Ct;u0=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.InvalidBytesLengthError=Ct.SizeExceedsPaddingSizeError=Ct.SliceOffsetOutOfBoundsError=void 0;const e=ue();class r extends e.BaseError{constructor({offset:s,position:o,size:a}){super(`Slice ${o==="start"?"starting":"ending"} at offset "${s}" is out-of-bounds (size: ${a}).`,{name:"SliceOffsetOutOfBoundsError"})}}Ct.SliceOffsetOutOfBoundsError=r;class n extends e.BaseError{constructor({size:s,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${s}) exceeds padding size (${o}).`,{name:"SizeExceedsPaddingSizeError"})}}Ct.SizeExceedsPaddingSizeError=n;class t extends e.BaseError{constructor({size:s,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} is expected to be ${o} ${a} long, but is ${s} ${a} long.`,{name:"InvalidBytesLengthError"})}}return Ct.InvalidBytesLengthError=t,Ct}var d0;function rr(){if(d0)return zr;d0=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.pad=r,zr.padHex=n,zr.padBytes=t;const e=au();function r(i,{dir:s,size:o=32}={}){return typeof i=="string"?n(i,{dir:s,size:o}):t(i,{dir:s,size:o})}function n(i,{dir:s,size:o=32}={}){if(o===null)return i;const a=i.replace("0x","");if(a.length>o*2)throw new e.SizeExceedsPaddingSizeError({size:Math.ceil(a.length/2),targetSize:o,type:"hex"});return`0x${a[s==="right"?"padEnd":"padStart"](o*2,"0")}`}function t(i,{dir:s,size:o=32}={}){if(o===null)return i;if(i.length>o)throw new e.SizeExceedsPaddingSizeError({size:i.length,targetSize:o,type:"bytes"});const a=new Uint8Array(o);for(let c=0;c<o;c++){const d=s==="right";a[d?c:o-c-1]=i[d?c:i.length-c-1]}return a}return zr}var Zt={},f0;function te(){if(f0)return Zt;f0=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.toHex=i,Zt.boolToHex=s,Zt.bytesToHex=o,Zt.numberToHex=a,Zt.stringToHex=d;const e=cn(),r=rr(),n=Be(),t=Array.from({length:256},(l,f)=>f.toString(16).padStart(2,"0"));function i(l,f={}){return typeof l=="number"||typeof l=="bigint"?a(l,f):typeof l=="string"?d(l,f):typeof l=="boolean"?s(l,f):o(l,f)}function s(l,f={}){const m=`0x${Number(l)}`;return typeof f.size=="number"?((0,n.assertSize)(m,{size:f.size}),(0,r.pad)(m,{size:f.size})):m}function o(l,f={}){let m="";for(let h=0;h<l.length;h++)m+=t[l[h]];const v=`0x${m}`;return typeof f.size=="number"?((0,n.assertSize)(v,{size:f.size}),(0,r.pad)(v,{dir:"right",size:f.size})):v}function a(l,f={}){const{signed:m,size:v}=f,h=BigInt(l);let b;v?m?b=(1n<<BigInt(v)*8n-1n)-1n:b=2n**(BigInt(v)*8n)-1n:typeof l=="number"&&(b=BigInt(Number.MAX_SAFE_INTEGER));const _=typeof b=="bigint"&&m?-b-1n:0;if(b&&h>b||h<_){const g=typeof l=="bigint"?"n":"";throw new e.IntegerOutOfRangeError({max:b?`${b}${g}`:void 0,min:`${_}${g}`,signed:m,size:v,value:`${l}${g}`})}const j=`0x${(m&&h<0?(1n<<BigInt(v*8))+BigInt(h):h).toString(16)}`;return v?(0,r.pad)(j,{size:v}):j}const c=new TextEncoder;function d(l,f={}){const m=c.encode(l);return o(m,f)}return Zt}var l0;function _e(){if(l0)return Kt;l0=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.toBytes=o,Kt.boolToBytes=a,Kt.hexToBytes=l,Kt.numberToBytes=f,Kt.stringToBytes=m;const e=ue(),r=Ge(),n=rr(),t=Be(),i=te(),s=new TextEncoder;function o(v,h={}){return typeof v=="number"||typeof v=="bigint"?f(v,h):typeof v=="boolean"?a(v,h):(0,r.isHex)(v)?l(v,h):m(v,h)}function a(v,h={}){const b=new Uint8Array(1);return b[0]=Number(v),typeof h.size=="number"?((0,t.assertSize)(b,{size:h.size}),(0,n.pad)(b,{size:h.size})):b}const c={zero:48,nine:57,A:65,F:70,a:97,f:102};function d(v){if(v>=c.zero&&v<=c.nine)return v-c.zero;if(v>=c.A&&v<=c.F)return v-(c.A-10);if(v>=c.a&&v<=c.f)return v-(c.a-10)}function l(v,h={}){let b=v;h.size&&((0,t.assertSize)(b,{size:h.size}),b=(0,n.pad)(b,{dir:"right",size:h.size}));let _=b.slice(2);_.length%2&&(_=`0${_}`);const j=_.length/2,g=new Uint8Array(j);for(let P=0,u=0;P<j;P++){const E=d(_.charCodeAt(u++)),p=d(_.charCodeAt(u++));if(E===void 0||p===void 0)throw new e.BaseError(`Invalid byte sequence ("${_[u-2]}${_[u-1]}" in "${_}").`);g[P]=E*16+p}return g}function f(v,h){const b=(0,i.numberToHex)(v,h);return l(b)}function m(v,h={}){const b=s.encode(v);return typeof h.size=="number"?((0,t.assertSize)(b,{size:h.size}),(0,n.pad)(b,{dir:"right",size:h.size})):b}return Kt}var b0;function Be(){if(b0)return xt;b0=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.assertSize=i,xt.fromHex=s,xt.hexToBigInt=o,xt.hexToBool=a,xt.hexToNumber=c,xt.hexToString=d;const e=cn(),r=Ye(),n=Ut(),t=_e();function i(l,{size:f}){if((0,r.size)(l)>f)throw new e.SizeOverflowError({givenSize:(0,r.size)(l),maxSize:f})}function s(l,f){const m=typeof f=="string"?{to:f}:f,v=m.to;return v==="number"?c(l,m):v==="bigint"?o(l,m):v==="string"?d(l,m):v==="boolean"?a(l,m):(0,t.hexToBytes)(l,m)}function o(l,f={}){const{signed:m}=f;f.size&&i(l,{size:f.size});const v=BigInt(l);if(!m)return v;const h=(l.length-2)/2,b=(1n<<BigInt(h)*8n-1n)-1n;return v<=b?v:v-BigInt(`0x${"f".padStart(h*2,"f")}`)-1n}function a(l,f={}){let m=l;if(f.size&&(i(m,{size:f.size}),m=(0,n.trim)(m)),(0,n.trim)(m)==="0x00")return!1;if((0,n.trim)(m)==="0x01")return!0;throw new e.InvalidHexBooleanError(m)}function c(l,f={}){return Number(o(l,f))}function d(l,f={}){let m=(0,t.hexToBytes)(l);return f.size&&(i(m,{size:f.size}),m=(0,n.trim)(m,{dir:"right"})),new TextDecoder().decode(m)}return xt}var Ur={},ni={},m0;function bo(){if(m0)return ni;m0=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.defineFormatter=e;function e(r,n){return({exclude:t,format:i})=>({exclude:t,format:(s,o)=>{const a=n(s,o);if(t)for(const c of t)delete a[c];return{...a,...i(s,o)}},type:r})}return ni}var Ju={},y0;function un(){return y0||(y0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defineTransaction=e.transactionType=void 0,e.formatTransaction=t;const r=Be(),n=bo();e.transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function t(s,o){const a={...s,blockHash:s.blockHash?s.blockHash:null,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,chainId:s.chainId?(0,r.hexToNumber)(s.chainId):void 0,gas:s.gas?BigInt(s.gas):void 0,gasPrice:s.gasPrice?BigInt(s.gasPrice):void 0,maxFeePerBlobGas:s.maxFeePerBlobGas?BigInt(s.maxFeePerBlobGas):void 0,maxFeePerGas:s.maxFeePerGas?BigInt(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?BigInt(s.maxPriorityFeePerGas):void 0,nonce:s.nonce?(0,r.hexToNumber)(s.nonce):void 0,to:s.to?s.to:null,transactionIndex:s.transactionIndex?Number(s.transactionIndex):null,type:s.type?e.transactionType[s.type]:void 0,typeHex:s.type?s.type:void 0,value:s.value?BigInt(s.value):void 0,v:s.v?BigInt(s.v):void 0};return s.authorizationList&&(a.authorizationList=i(s.authorizationList)),a.yParity=(()=>{if(s.yParity)return Number(s.yParity);if(typeof a.v=="bigint"){if(a.v===0n||a.v===27n)return 0;if(a.v===1n||a.v===28n)return 1;if(a.v>=35n)return a.v%2n===0n?1:0}})(),a.type==="legacy"&&(delete a.accessList,delete a.maxFeePerBlobGas,delete a.maxFeePerGas,delete a.maxPriorityFeePerGas,delete a.yParity),a.type==="eip2930"&&(delete a.maxFeePerBlobGas,delete a.maxFeePerGas,delete a.maxPriorityFeePerGas),a.type==="eip1559"&&delete a.maxFeePerBlobGas,a}e.defineTransaction=(0,n.defineFormatter)("transaction",t);function i(s){return s.map(o=>({address:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:o.r,s:o.s,yParity:Number(o.yParity)}))}}(Ju)),Ju}var h0;function su(){if(h0)return Ur;h0=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.defineBlock=void 0,Ur.formatBlock=n;const e=bo(),r=un();function n(t,i){const s=(t.transactions??[]).map(o=>typeof o=="string"?o:(0,r.formatTransaction)(o));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:s,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}return Ur.defineBlock=(0,e.defineFormatter)("block",n),Ur}var oi={},p0;function Lt(){if(p0)return oi;p0=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.formatLog=e;function e(r,{args:n,eventName:t}={}){return{...r,blockHash:r.blockHash?r.blockHash:null,blockNumber:r.blockNumber?BigInt(r.blockNumber):null,blockTimestamp:r.blockTimestamp?BigInt(r.blockTimestamp):r.blockTimestamp===null?null:void 0,logIndex:r.logIndex?Number(r.logIndex):null,transactionHash:r.transactionHash?r.transactionHash:null,transactionIndex:r.transactionIndex?Number(r.transactionIndex):null,...t?{args:n,eventName:t}:{}}}return oi}var Xu={},g0;function mo(){return g0||(g0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defineTransactionReceipt=e.receiptStatuses=void 0,e.formatTransactionReceipt=s;const r=Be(),n=bo(),t=Lt(),i=un();e.receiptStatuses={"0x0":"reverted","0x1":"success"};function s(o,a){const c={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(d=>(0,t.formatLog)(d)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?(0,r.hexToNumber)(o.transactionIndex):null,status:o.status?e.receiptStatuses[o.status]:null,type:o.type?i.transactionType[o.type]||o.type:null};return o.blobGasPrice&&(c.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(c.blobGasUsed=BigInt(o.blobGasUsed)),c}e.defineTransactionReceipt=(0,n.defineFormatter)("transactionReceipt",s)}(Xu)),Xu}var Qu={},_0;function _t(){return _0||(_0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defineTransactionRequest=e.rpcTransactionType=void 0,e.formatTransactionRequest=t;const r=te(),n=bo();e.rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function t(s,o){const a={};return typeof s.authorizationList<"u"&&(a.authorizationList=i(s.authorizationList)),typeof s.accessList<"u"&&(a.accessList=s.accessList),typeof s.blobVersionedHashes<"u"&&(a.blobVersionedHashes=s.blobVersionedHashes),typeof s.blobs<"u"&&(typeof s.blobs[0]!="string"?a.blobs=s.blobs.map(c=>(0,r.bytesToHex)(c)):a.blobs=s.blobs),typeof s.data<"u"&&(a.data=s.data),s.account&&(a.from=s.account.address),typeof s.from<"u"&&(a.from=s.from),typeof s.gas<"u"&&(a.gas=(0,r.numberToHex)(s.gas)),typeof s.gasPrice<"u"&&(a.gasPrice=(0,r.numberToHex)(s.gasPrice)),typeof s.maxFeePerBlobGas<"u"&&(a.maxFeePerBlobGas=(0,r.numberToHex)(s.maxFeePerBlobGas)),typeof s.maxFeePerGas<"u"&&(a.maxFeePerGas=(0,r.numberToHex)(s.maxFeePerGas)),typeof s.maxPriorityFeePerGas<"u"&&(a.maxPriorityFeePerGas=(0,r.numberToHex)(s.maxPriorityFeePerGas)),typeof s.nonce<"u"&&(a.nonce=(0,r.numberToHex)(s.nonce)),typeof s.to<"u"&&(a.to=s.to),typeof s.type<"u"&&(a.type=e.rpcTransactionType[s.type]),typeof s.value<"u"&&(a.value=(0,r.numberToHex)(s.value)),a}e.defineTransactionRequest=(0,n.defineFormatter)("transactionRequest",t);function i(s){return s.map(o=>({address:o.address,r:o.r?(0,r.numberToHex)(BigInt(o.r)):o.r,s:o.s?(0,r.numberToHex)(BigInt(o.s)):o.s,chainId:(0,r.numberToHex)(o.chainId),nonce:(0,r.numberToHex)(o.nonce),...typeof o.yParity<"u"?{yParity:(0,r.numberToHex)(o.yParity)}:{},...typeof o.v<"u"&&typeof o.yParity>"u"?{v:(0,r.numberToHex)(o.v)}:{}}))}}(Qu)),Qu}var D={},v0;function Pd(){return v0||(v0=1,Object.defineProperty(D,"__esModule",{value:!0}),D.minInt144=D.minInt136=D.minInt128=D.minInt120=D.minInt112=D.minInt104=D.minInt96=D.minInt88=D.minInt80=D.minInt72=D.minInt64=D.minInt56=D.minInt48=D.minInt40=D.minInt32=D.minInt24=D.minInt16=D.minInt8=D.maxInt256=D.maxInt248=D.maxInt240=D.maxInt232=D.maxInt224=D.maxInt216=D.maxInt208=D.maxInt200=D.maxInt192=D.maxInt184=D.maxInt176=D.maxInt168=D.maxInt160=D.maxInt152=D.maxInt144=D.maxInt136=D.maxInt128=D.maxInt120=D.maxInt112=D.maxInt104=D.maxInt96=D.maxInt88=D.maxInt80=D.maxInt72=D.maxInt64=D.maxInt56=D.maxInt48=D.maxInt40=D.maxInt32=D.maxInt24=D.maxInt16=D.maxInt8=void 0,D.maxUint256=D.maxUint248=D.maxUint240=D.maxUint232=D.maxUint224=D.maxUint216=D.maxUint208=D.maxUint200=D.maxUint192=D.maxUint184=D.maxUint176=D.maxUint168=D.maxUint160=D.maxUint152=D.maxUint144=D.maxUint136=D.maxUint128=D.maxUint120=D.maxUint112=D.maxUint104=D.maxUint96=D.maxUint88=D.maxUint80=D.maxUint72=D.maxUint64=D.maxUint56=D.maxUint48=D.maxUint40=D.maxUint32=D.maxUint24=D.maxUint16=D.maxUint8=D.minInt256=D.minInt248=D.minInt240=D.minInt232=D.minInt224=D.minInt216=D.minInt208=D.minInt200=D.minInt192=D.minInt184=D.minInt176=D.minInt168=D.minInt160=D.minInt152=void 0,D.maxInt8=2n**(8n-1n)-1n,D.maxInt16=2n**(16n-1n)-1n,D.maxInt24=2n**(24n-1n)-1n,D.maxInt32=2n**(32n-1n)-1n,D.maxInt40=2n**(40n-1n)-1n,D.maxInt48=2n**(48n-1n)-1n,D.maxInt56=2n**(56n-1n)-1n,D.maxInt64=2n**(64n-1n)-1n,D.maxInt72=2n**(72n-1n)-1n,D.maxInt80=2n**(80n-1n)-1n,D.maxInt88=2n**(88n-1n)-1n,D.maxInt96=2n**(96n-1n)-1n,D.maxInt104=2n**(104n-1n)-1n,D.maxInt112=2n**(112n-1n)-1n,D.maxInt120=2n**(120n-1n)-1n,D.maxInt128=2n**(128n-1n)-1n,D.maxInt136=2n**(136n-1n)-1n,D.maxInt144=2n**(144n-1n)-1n,D.maxInt152=2n**(152n-1n)-1n,D.maxInt160=2n**(160n-1n)-1n,D.maxInt168=2n**(168n-1n)-1n,D.maxInt176=2n**(176n-1n)-1n,D.maxInt184=2n**(184n-1n)-1n,D.maxInt192=2n**(192n-1n)-1n,D.maxInt200=2n**(200n-1n)-1n,D.maxInt208=2n**(208n-1n)-1n,D.maxInt216=2n**(216n-1n)-1n,D.maxInt224=2n**(224n-1n)-1n,D.maxInt232=2n**(232n-1n)-1n,D.maxInt240=2n**(240n-1n)-1n,D.maxInt248=2n**(248n-1n)-1n,D.maxInt256=2n**(256n-1n)-1n,D.minInt8=-(2n**(8n-1n)),D.minInt16=-(2n**(16n-1n)),D.minInt24=-(2n**(24n-1n)),D.minInt32=-(2n**(32n-1n)),D.minInt40=-(2n**(40n-1n)),D.minInt48=-(2n**(48n-1n)),D.minInt56=-(2n**(56n-1n)),D.minInt64=-(2n**(64n-1n)),D.minInt72=-(2n**(72n-1n)),D.minInt80=-(2n**(80n-1n)),D.minInt88=-(2n**(88n-1n)),D.minInt96=-(2n**(96n-1n)),D.minInt104=-(2n**(104n-1n)),D.minInt112=-(2n**(112n-1n)),D.minInt120=-(2n**(120n-1n)),D.minInt128=-(2n**(128n-1n)),D.minInt136=-(2n**(136n-1n)),D.minInt144=-(2n**(144n-1n)),D.minInt152=-(2n**(152n-1n)),D.minInt160=-(2n**(160n-1n)),D.minInt168=-(2n**(168n-1n)),D.minInt176=-(2n**(176n-1n)),D.minInt184=-(2n**(184n-1n)),D.minInt192=-(2n**(192n-1n)),D.minInt200=-(2n**(200n-1n)),D.minInt208=-(2n**(208n-1n)),D.minInt216=-(2n**(216n-1n)),D.minInt224=-(2n**(224n-1n)),D.minInt232=-(2n**(232n-1n)),D.minInt240=-(2n**(240n-1n)),D.minInt248=-(2n**(248n-1n)),D.minInt256=-(2n**(256n-1n)),D.maxUint8=2n**8n-1n,D.maxUint16=2n**16n-1n,D.maxUint24=2n**24n-1n,D.maxUint32=2n**32n-1n,D.maxUint40=2n**40n-1n,D.maxUint48=2n**48n-1n,D.maxUint56=2n**56n-1n,D.maxUint64=2n**64n-1n,D.maxUint72=2n**72n-1n,D.maxUint80=2n**80n-1n,D.maxUint88=2n**88n-1n,D.maxUint96=2n**96n-1n,D.maxUint104=2n**104n-1n,D.maxUint112=2n**112n-1n,D.maxUint120=2n**120n-1n,D.maxUint128=2n**128n-1n,D.maxUint136=2n**136n-1n,D.maxUint144=2n**144n-1n,D.maxUint152=2n**152n-1n,D.maxUint160=2n**160n-1n,D.maxUint168=2n**168n-1n,D.maxUint176=2n**176n-1n,D.maxUint184=2n**184n-1n,D.maxUint192=2n**192n-1n,D.maxUint200=2n**200n-1n,D.maxUint208=2n**208n-1n,D.maxUint216=2n**216n-1n,D.maxUint224=2n**224n-1n,D.maxUint232=2n**232n-1n,D.maxUint240=2n**240n-1n,D.maxUint248=2n**248n-1n,D.maxUint256=2n**256n-1n),D}var Lr={},E0;function Me(){if(E0)return Lr;E0=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.concat=e,Lr.concatBytes=r,Lr.concatHex=n;function e(t){return typeof t[0]=="string"?n(t):r(t)}function r(t){let i=0;for(const a of t)i+=a.length;const s=new Uint8Array(i);let o=0;for(const a of t)s.set(a,o),o+=a.length;return s}function n(t){return`0x${t.reduce((i,s)=>i+s.replace("0x",""),"")}`}return Lr}var Dr={},ii={},qt={},j0;function Qh(){if(j0)return qt;j0=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.RecursiveReadLimitExceededError=qt.PositionOutOfBoundsError=qt.NegativeOffsetError=void 0;const e=ue();class r extends e.BaseError{constructor({offset:s}){super(`Offset \`${s}\` cannot be negative.`,{name:"NegativeOffsetError"})}}qt.NegativeOffsetError=r;class n extends e.BaseError{constructor({length:s,position:o}){super(`Position \`${o}\` is out of bounds (\`0 < position < ${s}\`).`,{name:"PositionOutOfBoundsError"})}}qt.PositionOutOfBoundsError=n;class t extends e.BaseError{constructor({count:s,limit:o}){super(`Recursive read limit of \`${o}\` exceeded (recursive read count: \`${s}\`).`,{name:"RecursiveReadLimitExceededError"})}}return qt.RecursiveReadLimitExceededError=t,qt}var w0;function yo(){if(w0)return ii;w0=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.createCursor=n;const e=Qh(),r={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new e.RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new e.PositionOutOfBoundsError({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new e.NegativeOffsetError({offset:t});const i=this.position-t;this.assertPosition(i),this.position=i},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new e.NegativeOffsetError({offset:t});const i=this.position+t;this.assertPosition(i),this.position=i},inspectByte(t){const i=t??this.position;return this.assertPosition(i),this.bytes[i]},inspectBytes(t,i){const s=i??this.position;return this.assertPosition(s+t-1),this.bytes.subarray(s,s+t)},inspectUint8(t){const i=t??this.position;return this.assertPosition(i),this.bytes[i]},inspectUint16(t){const i=t??this.position;return this.assertPosition(i+1),this.dataView.getUint16(i)},inspectUint24(t){const i=t??this.position;return this.assertPosition(i+2),(this.dataView.getUint16(i)<<8)+this.dataView.getUint8(i+2)},inspectUint32(t){const i=t??this.position;return this.assertPosition(i+3),this.dataView.getUint32(i)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,i){this.assertReadLimit(),this._touch();const s=this.inspectBytes(t);return this.position+=i??t,s},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const i=this.position;return this.assertPosition(t),this.position=t,()=>this.position=i},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function n(t,{recursiveReadLimit:i=8192}={}){const s=Object.create(r);return s.bytes=t,s.dataView=new DataView(t.buffer??t,t.byteOffset,t.byteLength),s.positionReadCount=new Map,s.recursiveReadLimit=i,s}return ii}var P0;function ho(){if(P0)return Dr;P0=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.toRlp=i,Dr.bytesToRlp=s,Dr.hexToRlp=o;const e=ue(),r=yo(),n=_e(),t=te();function i(f,m="hex"){const v=a(f),h=(0,r.createCursor)(new Uint8Array(v.length));return v.encode(h),m==="hex"?(0,t.bytesToHex)(h.bytes):h.bytes}function s(f,m="bytes"){return i(f,m)}function o(f,m="hex"){return i(f,m)}function a(f){return Array.isArray(f)?c(f.map(m=>a(m))):d(f)}function c(f){const m=f.reduce((b,_)=>b+_.length,0),v=l(m);return{length:(()=>m<=55?1+m:1+v+m)(),encode(b){m<=55?b.pushByte(192+m):(b.pushByte(192+55+v),v===1?b.pushUint8(m):v===2?b.pushUint16(m):v===3?b.pushUint24(m):b.pushUint32(m));for(const{encode:_}of f)_(b)}}}function d(f){const m=typeof f=="string"?(0,n.hexToBytes)(f):f,v=l(m.length);return{length:(()=>m.length===1&&m[0]<128?1:m.length<=55?1+m.length:1+v+m.length)(),encode(b){m.length===1&&m[0]<128?b.pushBytes(m):m.length<=55?(b.pushByte(128+m.length),b.pushBytes(m)):(b.pushByte(128+55+v),v===1?b.pushUint8(m.length):v===2?b.pushUint16(m.length):v===3?b.pushUint24(m.length):b.pushUint32(m.length),b.pushBytes(m))}}}function l(f){if(f<2**8)return 1;if(f<2**16)return 2;if(f<2**24)return 3;if(f<2**32)return 4;throw new e.BaseError("Length is too large.")}return Dr}var An={},ve={},ai={},Mt={},A0;function po(){return A0||(A0=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.weiUnits=Mt.gweiUnits=Mt.etherUnits=void 0,Mt.etherUnits={gwei:9,wei:18},Mt.gweiUnits={ether:-9,wei:9},Mt.weiUnits={ether:-18,gwei:-9}),Mt}var si={},T0;function cu(){if(T0)return si;T0=1,Object.defineProperty(si,"__esModule",{value:!0}),si.formatUnits=e;function e(r,n){let t=r.toString();const i=t.startsWith("-");i&&(t=t.slice(1)),t=t.padStart(n,"0");let[s,o]=[t.slice(0,t.length-n),t.slice(t.length-n)];return o=o.replace(/(0+)$/,""),`${i?"-":""}${s||"0"}${o?`.${o}`:""}`}return si}var I0;function go(){if(I0)return ai;I0=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.formatEther=n;const e=po(),r=cu();function n(t,i="wei"){return(0,r.formatUnits)(t,e.etherUnits[i])}return ai}var ci={},S0;function Rr(){if(S0)return ci;S0=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.formatGwei=n;const e=po(),r=cu();function n(t,i="wei"){return(0,r.formatUnits)(t,e.gweiUnits[i])}return ci}var B0;function Je(){if(B0)return ve;B0=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.WaitForTransactionReceiptTimeoutError=ve.TransactionReceiptRevertedError=ve.TransactionReceiptNotFoundError=ve.TransactionNotFoundError=ve.TransactionExecutionError=ve.InvalidStorageKeySizeError=ve.InvalidSerializedTransactionError=ve.InvalidSerializedTransactionTypeError=ve.InvalidSerializableTransactionError=ve.InvalidLegacyVError=ve.FeeConflictError=void 0,ve.prettyPrint=t;const e=go(),r=Rr(),n=ue();function t(b){const _=Object.entries(b).map(([g,P])=>P===void 0||P===!1?null:[g,P]).filter(Boolean),j=_.reduce((g,[P])=>Math.max(g,P.length),0);return _.map(([g,P])=>` ${`${g}:`.padEnd(j+1)} ${P}`).join(`
|
|
4
4
|
`)}class i extends n.BaseError{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bz as Nr,i as xr,bt as Cr,e as H,c as be,bA as Ce,g as Lr,bI as Ur}from"./index-
|
|
1
|
+
import{bz as Nr,i as xr,bt as Cr,e as H,c as be,bA as Ce,g as Lr,bI as Ur}from"./index-2ef9f1d1.js";var Be={exports:{}},Me={},xe={},Qe;function Or(){if(Qe)return xe;Qe=1,xe.byteLength=i,xe.toByteArray=S,xe.fromByteArray=g;for(var T=[],w=[],M=typeof Uint8Array<"u"?Uint8Array:Array,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=0,E=_.length;L<E;++L)T[L]=_[L],w[_.charCodeAt(L)]=L;w["-".charCodeAt(0)]=62,w["_".charCodeAt(0)]=63;function p(m){var b=m.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=m.indexOf("=");F===-1&&(F=b);var x=F===b?0:4-F%4;return[F,x]}function i(m){var b=p(m),F=b[0],x=b[1];return(F+x)*3/4-x}function l(m,b,F){return(b+F)*3/4-F}function S(m){var b,F=p(m),x=F[0],u=F[1],y=new M(l(m,x,u)),C=0,N=u>0?x-4:x,I;for(I=0;I<N;I+=4)b=w[m.charCodeAt(I)]<<18|w[m.charCodeAt(I+1)]<<12|w[m.charCodeAt(I+2)]<<6|w[m.charCodeAt(I+3)],y[C++]=b>>16&255,y[C++]=b>>8&255,y[C++]=b&255;return u===2&&(b=w[m.charCodeAt(I)]<<2|w[m.charCodeAt(I+1)]>>4,y[C++]=b&255),u===1&&(b=w[m.charCodeAt(I)]<<10|w[m.charCodeAt(I+1)]<<4|w[m.charCodeAt(I+2)]>>2,y[C++]=b>>8&255,y[C++]=b&255),y}function R(m){return T[m>>18&63]+T[m>>12&63]+T[m>>6&63]+T[m&63]}function h(m,b,F){for(var x,u=[],y=b;y<F;y+=3)x=(m[y]<<16&16711680)+(m[y+1]<<8&65280)+(m[y+2]&255),u.push(R(x));return u.join("")}function g(m){for(var b,F=m.length,x=F%3,u=[],y=16383,C=0,N=F-x;C<N;C+=y)u.push(h(m,C,C+y>N?N:C+y));return x===1?(b=m[F-1],u.push(T[b>>2]+T[b<<4&63]+"==")):x===2&&(b=(m[F-2]<<8)+m[F-1],u.push(T[b>>10]+T[b>>4&63]+T[b<<2&63]+"=")),u.join("")}return xe}var Fe={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var er;function Dr(){return er||(er=1,Fe.read=function(T,w,M,_,L){var E,p,i=L*8-_-1,l=(1<<i)-1,S=l>>1,R=-7,h=M?L-1:0,g=M?-1:1,m=T[w+h];for(h+=g,E=m&(1<<-R)-1,m>>=-R,R+=i;R>0;E=E*256+T[w+h],h+=g,R-=8);for(p=E&(1<<-R)-1,E>>=-R,R+=_;R>0;p=p*256+T[w+h],h+=g,R-=8);if(E===0)E=1-S;else{if(E===l)return p?NaN:(m?-1:1)*(1/0);p=p+Math.pow(2,_),E=E-S}return(m?-1:1)*p*Math.pow(2,E-_)},Fe.write=function(T,w,M,_,L,E){var p,i,l,S=E*8-L-1,R=(1<<S)-1,h=R>>1,g=L===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=_?0:E-1,b=_?1:-1,F=w<0||w===0&&1/w<0?1:0;for(w=Math.abs(w),isNaN(w)||w===1/0?(i=isNaN(w)?1:0,p=R):(p=Math.floor(Math.log(w)/Math.LN2),w*(l=Math.pow(2,-p))<1&&(p--,l*=2),p+h>=1?w+=g/l:w+=g*Math.pow(2,1-h),w*l>=2&&(p++,l/=2),p+h>=R?(i=0,p=R):p+h>=1?(i=(w*l-1)*Math.pow(2,L),p=p+h):(i=w*Math.pow(2,h-1)*Math.pow(2,L),p=0));L>=8;T[M+m]=i&255,m+=b,i/=256,L-=8);for(p=p<<L|i,S+=L;S>0;T[M+m]=p&255,m+=b,p/=256,S-=8);T[M+m-b]|=F*128}),Fe}/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as b,t as _e,w as Be,l as Te,u as Ue,v as ze,n as f,a as ye,y as Ye,C as he,c as z,S as v,R as p,z as Z,B as J,D as Xe,F as te,b as de,E as M,G as ue,I as pe,M as R,J as Fe,d as A,r as se,i as x,x as l,h as Le,K as me,g as ke,e as qe,L as Y,O as y,s as He,A as le,T as Qe,P as Ze}from"./core-0c13d1dd.js";import{c as T,n as h,o as O,r as m,U as je}from"./index-bc60e460.js";import"./index-726bc846.js";import"./index-37d53923.js";import"./index-c2e969f4.js";const j={getGasPriceInEther(e,t){const o=t*e;return Number(o)/1e18},getGasPriceInUSD(e,t,o){const n=j.getGasPriceInEther(t,o);return b.bigNumber(e).times(n).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:o,toTokenAmount:n}){const a=b.bigNumber(e).times(t),i=b.bigNumber(n).times(o);return a.minus(i).div(a).times(100).toNumber()},getMaxSlippage(e,t){const o=b.bigNumber(e).div(100);return b.multiply(t,o).toNumber()},getProviderFee(e,t=.0085){return b.bigNumber(e).times(t).toString()},isInsufficientNetworkTokenForGas(e,t){const o=t||"0";return b.bigNumber(e).eq(0)?!0:b.bigNumber(b.bigNumber(o)).gt(e)},isInsufficientSourceTokenForSwap(e,t,o){var i,s;const n=(s=(i=o==null?void 0:o.find(c=>c.address===t))==null?void 0:i.quantity)==null?void 0:s.numeric;return b.bigNumber(n||"0").lt(e)}},We=15e4,Je=6,S={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:Te.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},r=_e({...S}),we={state:r,subscribe(e){return Ue(r,()=>e(r))},subscribeKey(e,t){return ze(r,e,t)},getParams(){var d,w,g,P,E,F,L,H,Q;const e=f.state.activeChain,t=((d=f.getAccountData(e))==null?void 0:d.caipAddress)??f.state.activeCaipAddress,o=ye.getPlainAddress(t),n=Ye(),a=he.getConnectorId(f.state.activeChain);if(!o)throw new Error("No address found to swap the tokens from.");const i=!((w=r.toToken)!=null&&w.address)||!((g=r.toToken)!=null&&g.decimals),s=!((P=r.sourceToken)!=null&&P.address)||!((E=r.sourceToken)!=null&&E.decimals)||!b.bigNumber(r.sourceTokenAmount).gt(0),c=!r.sourceTokenAmount;return{networkAddress:n,fromAddress:o,fromCaipAddress:t,sourceTokenAddress:(F=r.sourceToken)==null?void 0:F.address,toTokenAddress:(L=r.toToken)==null?void 0:L.address,toTokenAmount:r.toTokenAmount,toTokenDecimals:(H=r.toToken)==null?void 0:H.decimals,sourceTokenAmount:r.sourceTokenAmount,sourceTokenDecimals:(Q=r.sourceToken)==null?void 0:Q.decimals,invalidToToken:i,invalidSourceToken:s,invalidSourceTokenAmount:c,availableToSwap:t&&!i&&!s&&!c,isAuthConnector:a===z.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e){r.sourceToken=e,r.sourceTokenAmount="",r.sourceTokenPriceInUSD=0;return}r.sourceToken=e,await u.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){r.sourceTokenAmount=e},async setToToken(e){if(!e){r.toToken=e,r.toTokenAmount="",r.toTokenPriceInUSD=0;return}r.toToken=e,await u.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){r.toTokenAmount=e?b.toFixed(e,Je):""},async setTokenPrice(e,t){let o=r.tokensPriceMap[e]||0;o||(r.loadingPrices=!0,o=await u.getAddressPrice(e)),t==="sourceToken"?r.sourceTokenPriceInUSD=o:t==="toToken"&&(r.toTokenPriceInUSD=o),r.loadingPrices&&(r.loadingPrices=!1),u.getParams().availableToSwap&&!r.switchingTokens&&u.swapTokens()},async switchTokens(){if(!(r.initializing||!r.initialized||r.switchingTokens)){r.switchingTokens=!0;try{const e=r.toToken?{...r.toToken}:void 0,t=r.sourceToken?{...r.sourceToken}:void 0,o=e&&r.toTokenAmount===""?"1":r.toTokenAmount;u.setSourceTokenAmount(o),u.setToTokenAmount(""),await u.setSourceToken(e),await u.setToToken(t),r.switchingTokens=!1,u.swapTokens()}catch(e){throw r.switchingTokens=!1,e}}},resetState(){r.myTokensWithBalance=S.myTokensWithBalance,r.tokensPriceMap=S.tokensPriceMap,r.initialized=S.initialized,r.initializing=S.initializing,r.switchingTokens=S.switchingTokens,r.sourceToken=S.sourceToken,r.sourceTokenAmount=S.sourceTokenAmount,r.sourceTokenPriceInUSD=S.sourceTokenPriceInUSD,r.toToken=S.toToken,r.toTokenAmount=S.toTokenAmount,r.toTokenPriceInUSD=S.toTokenPriceInUSD,r.networkPrice=S.networkPrice,r.networkTokenSymbol=S.networkTokenSymbol,r.networkBalanceInUSD=S.networkBalanceInUSD,r.inputError=S.inputError},resetValues(){var o;const{networkAddress:e}=u.getParams(),t=(o=r.tokens)==null?void 0:o.find(n=>n.address===e);u.setSourceToken(t),u.setToToken(void 0)},getApprovalLoadingState(){return r.loadingApprovalTransaction},clearError(){r.transactionError=void 0},async initializeState(){if(!r.initializing){if(r.initializing=!0,!r.initialized)try{await u.fetchTokens(),r.initialized=!0}catch{r.initialized=!1,v.showError("Failed to initialize swap"),p.goBack()}r.initializing=!1}},async fetchTokens(){var o;const{networkAddress:e}=u.getParams();await u.getNetworkTokenPrice(),await u.getMyTokensWithBalance();const t=(o=r.myTokensWithBalance)==null?void 0:o.find(n=>n.address===e);t&&(r.networkTokenSymbol=t.symbol,u.setSourceToken(t),u.setSourceTokenAmount("0"))},async getTokenList(){var t,o;const e=(t=f.state.activeCaipNetwork)==null?void 0:t.caipNetworkId;if(!(r.caipNetworkId===e&&r.tokens))try{r.tokensLoading=!0;const n=await Z.getTokenList(e);r.tokens=n,r.caipNetworkId=e,r.popularTokens=n.sort((d,w)=>d.symbol<w.symbol?-1:d.symbol>w.symbol?1:0);const i=(e&&((o=Te.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:o[e])||[]).map(d=>n.find(w=>w.symbol===d)).filter(d=>!!d),c=(Te.SWAP_SUGGESTED_TOKENS||[]).map(d=>n.find(w=>w.symbol===d)).filter(d=>!!d).filter(d=>!i.some(w=>w.address===d.address));r.suggestedTokens=[...i,...c]}catch{r.tokens=[],r.popularTokens=[],r.suggestedTokens=[]}finally{r.tokensLoading=!1}},async getAddressPrice(e){var d,w;const t=r.tokensPriceMap[e];if(t)return t;const o=await J.fetchTokenPrice({addresses:[e]}),n=(o==null?void 0:o.fungibles)||[],a=[...r.tokens||[],...r.myTokensWithBalance||[]],i=(d=a==null?void 0:a.find(g=>g.address===e))==null?void 0:d.symbol,s=((w=n.find(g=>g.symbol.toLowerCase()===(i==null?void 0:i.toLowerCase())))==null?void 0:w.price)||0,c=parseFloat(s.toString());return r.tokensPriceMap[e]=c,c},async getNetworkTokenPrice(){var a;const{networkAddress:e}=u.getParams(),o=(a=(await J.fetchTokenPrice({addresses:[e]}).catch(()=>(v.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:a[0],n=(o==null?void 0:o.price.toString())||"0";r.tokensPriceMap[e]=parseFloat(n),r.networkTokenSymbol=(o==null?void 0:o.symbol)||"",r.networkPrice=n},async getMyTokensWithBalance(e){const t=await Xe.getMyTokensWithBalance(e),o=Z.mapBalancesToSwapTokens(t);o&&(await u.getInitialGasPrice(),u.setBalances(o))},setBalances(e){const{networkAddress:t}=u.getParams(),o=f.state.activeCaipNetwork;if(!o)return;const n=e.find(a=>a.address===t);e.forEach(a=>{r.tokensPriceMap[a.address]=a.price||0}),r.myTokensWithBalance=e.filter(a=>a.address.startsWith(o.caipNetworkId)),r.networkBalanceInUSD=n?b.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var t,o;const e=await Z.fetchGasPrice();if(!e)return{gasPrice:null,gasPriceInUSD:null};switch((o=(t=f.state)==null?void 0:t.activeCaipNetwork)==null?void 0:o.chainNamespace){case z.CHAIN.SOLANA:return r.gasFee=e.standard??"0",r.gasPriceInUSD=b.multiply(e.standard,r.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(r.gasFee),gasPriceInUSD:Number(r.gasPriceInUSD)};case z.CHAIN.EVM:default:const n=e.standard??"0",a=BigInt(n),i=BigInt(We),s=j.getGasPriceInUSD(r.networkPrice,i,a);return r.gasFee=n,r.gasPriceInUSD=s,{gasPrice:a,gasPriceInUSD:s}}},async swapTokens(){var i,s,c;const e=(i=f.getAccountData())==null?void 0:i.address,t=r.sourceToken,o=r.toToken,n=b.bigNumber(r.sourceTokenAmount).gt(0);if(n||u.setToTokenAmount(""),!o||!t||r.loadingPrices||!n||!e)return;r.loadingQuote=!0;const a=b.bigNumber(r.sourceTokenAmount).times(10**t.decimals).round(0);try{const d=await J.fetchSwapQuote({userAddress:e,from:t.address,to:o.address,gasPrice:r.gasFee,amount:a.toString()});r.loadingQuote=!1;const w=(c=(s=d==null?void 0:d.quotes)==null?void 0:s[0])==null?void 0:c.toAmount;if(!w){te.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const g=b.bigNumber(w).div(10**o.decimals).toString();u.setToTokenAmount(g),u.hasInsufficientToken(r.sourceTokenAmount,t.address)?r.inputError="Insufficient balance":(r.inputError=void 0,u.setTransactionDetails())}catch(d){const w=await Z.handleSwapError(d);r.loadingQuote=!1,r.inputError=w||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=u.getParams(),o=r.sourceToken,n=r.toToken;if(!(!e||!t||!o||!n||r.loadingQuote))try{r.loadingBuildTransaction=!0;const a=await Z.fetchSwapAllowance({userAddress:e,tokenAddress:o.address,sourceTokenAmount:r.sourceTokenAmount,sourceTokenDecimals:o.decimals});let i;return a?i=await u.createSwapTransaction():i=await u.createAllowanceTransaction(),r.loadingBuildTransaction=!1,r.fetchError=!1,i}catch{p.goBack(),v.showError("Failed to check allowance"),r.loadingBuildTransaction=!1,r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:e,sourceTokenAddress:t,toTokenAddress:o}=u.getParams();if(!(!e||!o)){if(!t)throw new Error("createAllowanceTransaction - No source token address found.");try{const n=await J.generateApproveCalldata({from:t,to:o,userAddress:e}),a=ye.getPlainAddress(n.tx.from);if(!a)throw new Error("SwapController:createAllowanceTransaction - address is required");const i={data:n.tx.data,to:a,gasPrice:BigInt(n.tx.eip155.gasPrice),value:BigInt(n.tx.value),toAmount:r.toTokenAmount};return r.swapTransaction=void 0,r.approvalTransaction={data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount},{data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount}}catch{p.goBack(),v.showError("Failed to create approval transaction"),r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}}},async createSwapTransaction(){var s;const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:o}=u.getParams(),n=r.sourceToken,a=r.toToken;if(!t||!o||!n||!a)return;const i=(s=de.parseUnits(o,n.decimals))==null?void 0:s.toString();try{const c=await J.generateSwapCalldata({userAddress:t,from:n.address,to:a.address,amount:i,disableEstimate:!0}),d=n.address===e,w=BigInt(c.tx.eip155.gas),g=BigInt(c.tx.eip155.gasPrice),P=ye.getPlainAddress(c.tx.to);if(!P)throw new Error("SwapController:createSwapTransaction - address is required");const E={data:c.tx.data,to:P,gas:w,gasPrice:g,value:BigInt(d?i??"0":"0"),toAmount:r.toTokenAmount};return r.gasPriceInUSD=j.getGasPriceInUSD(r.networkPrice,w,g),r.approvalTransaction=void 0,r.swapTransaction=E,E}catch{p.goBack(),v.showError("Failed to create transaction"),r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){v.showLoading("Approve limit increase in your wallet"),p.replace("SwapPreview")},async sendTransactionForApproval(e){var a,i,s;const{fromAddress:t,isAuthConnector:o}=u.getParams();r.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";o?p.pushTransactionStack({onSuccess:u.onEmbeddedWalletApprovalSuccess}):v.showLoading(n);try{await de.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:z.CHAIN.EVM}),await u.swapTokens(),await u.getTransaction(),r.approvalTransaction=void 0,r.loadingApprovalTransaction=!1}catch(c){const d=c;r.transactionError=d==null?void 0:d.displayMessage,r.loadingApprovalTransaction=!1,v.showError((d==null?void 0:d.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(d==null?void 0:d.displayMessage)||(d==null?void 0:d.message)||"Unknown",network:((a=f.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)||"",swapFromToken:((i=u.state.sourceToken)==null?void 0:i.symbol)||"",swapToToken:((s=u.state.toToken)==null?void 0:s.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(e){var s,c,d,w,g,P,E,F,L,H,Q,Ee;if(!e)return;const{fromAddress:t,toTokenAmount:o,isAuthConnector:n}=u.getParams();r.loadingTransaction=!0;const a=`Swapping ${(s=r.sourceToken)==null?void 0:s.symbol} to ${b.formatNumberToLocalString(o,3)} ${(c=r.toToken)==null?void 0:c.symbol}`,i=`Swapped ${(d=r.sourceToken)==null?void 0:d.symbol} to ${b.formatNumberToLocalString(o,3)} ${(w=r.toToken)==null?void 0:w.symbol}`;n?p.pushTransactionStack({onSuccess(){p.replace("Account"),v.showLoading(a),we.resetState()}}):v.showLoading("Confirm transaction in your wallet");try{const ve=[(g=r.sourceToken)==null?void 0:g.address,(P=r.toToken)==null?void 0:P.address].join(","),$=await de.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:z.CHAIN.EVM});return r.loadingTransaction=!1,v.showSuccess(i),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((E=f.state.activeCaipNetwork)==null?void 0:E.caipNetworkId)||"",swapFromToken:((F=u.state.sourceToken)==null?void 0:F.symbol)||"",swapToToken:((L=u.state.toToken)==null?void 0:L.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}}),we.resetState(),n||p.replace("Account"),we.getMyTokensWithBalance(ve),$}catch(ve){const $=ve;r.transactionError=$==null?void 0:$.displayMessage,r.loadingTransaction=!1,v.showError(($==null?void 0:$.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:($==null?void 0:$.displayMessage)||($==null?void 0:$.message)||"Unknown",network:((H=f.state.activeCaipNetwork)==null?void 0:H.caipNetworkId)||"",swapFromToken:((Q=u.state.sourceToken)==null?void 0:Q.symbol)||"",swapToToken:((Ee=u.state.toToken)==null?void 0:Ee.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(e,t){return j.isInsufficientSourceTokenForSwap(e,t,r.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=u.getParams();!e||!t||(r.gasPriceInUSD=j.getGasPriceInUSD(r.networkPrice,BigInt(r.gasFee),BigInt(We)),r.priceImpact=j.getPriceImpact({sourceTokenAmount:r.sourceTokenAmount,sourceTokenPriceInUSD:r.sourceTokenPriceInUSD,toTokenPriceInUSD:r.toTokenPriceInUSD,toTokenAmount:r.toTokenAmount}),r.maxSlippage=j.getMaxSlippage(r.slippage,r.toTokenAmount),r.providerFee=j.getProviderFee(r.sourceTokenAmount))}},u=Be(we),W=_e({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),et={state:W,subscribe(e){return Ue(W,()=>e(W))},subscribeKey(e,t){return ze(W,e,t)},showTooltip({message:e,triggerRect:t,variant:o}){W.open=!0,W.message=e,W.triggerRect=t,W.variant=o},hide(){W.open=!1,W.message="",W.triggerRect={width:0,height:0,top:0,left:0}}},ee=Be(et),Me={isUnsupportedChainView(){return p.state.view==="UnsupportedChain"||p.state.view==="SwitchNetwork"&&p.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){R.shake();return}if(await Fe.isSIWXCloseDisabled()){R.shake();return}(p.state.view==="DataCapture"||p.state.view==="DataCaptureOtpConfirm")&&de.disconnect(),R.close()}},tt=A`
|
|
1
|
+
import{N as b,t as _e,w as Be,l as Te,u as Ue,v as ze,n as f,a as ye,y as Ye,C as he,c as z,S as v,R as p,z as Z,B as J,D as Xe,F as te,b as de,E as M,G as ue,I as pe,M as R,J as Fe,d as A,r as se,i as x,x as l,h as Le,K as me,g as ke,e as qe,L as Y,O as y,s as He,A as le,T as Qe,P as Ze}from"./core-806d78ea.js";import{c as T,n as h,o as O,r as m,U as je}from"./index-372705ba.js";import"./index-2ef9f1d1.js";import"./index-74e34dfb.js";import"./index-c1c8440f.js";const j={getGasPriceInEther(e,t){const o=t*e;return Number(o)/1e18},getGasPriceInUSD(e,t,o){const n=j.getGasPriceInEther(t,o);return b.bigNumber(e).times(n).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:o,toTokenAmount:n}){const a=b.bigNumber(e).times(t),i=b.bigNumber(n).times(o);return a.minus(i).div(a).times(100).toNumber()},getMaxSlippage(e,t){const o=b.bigNumber(e).div(100);return b.multiply(t,o).toNumber()},getProviderFee(e,t=.0085){return b.bigNumber(e).times(t).toString()},isInsufficientNetworkTokenForGas(e,t){const o=t||"0";return b.bigNumber(e).eq(0)?!0:b.bigNumber(b.bigNumber(o)).gt(e)},isInsufficientSourceTokenForSwap(e,t,o){var i,s;const n=(s=(i=o==null?void 0:o.find(c=>c.address===t))==null?void 0:i.quantity)==null?void 0:s.numeric;return b.bigNumber(n||"0").lt(e)}},We=15e4,Je=6,S={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:Te.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},r=_e({...S}),we={state:r,subscribe(e){return Ue(r,()=>e(r))},subscribeKey(e,t){return ze(r,e,t)},getParams(){var d,w,g,P,E,F,L,H,Q;const e=f.state.activeChain,t=((d=f.getAccountData(e))==null?void 0:d.caipAddress)??f.state.activeCaipAddress,o=ye.getPlainAddress(t),n=Ye(),a=he.getConnectorId(f.state.activeChain);if(!o)throw new Error("No address found to swap the tokens from.");const i=!((w=r.toToken)!=null&&w.address)||!((g=r.toToken)!=null&&g.decimals),s=!((P=r.sourceToken)!=null&&P.address)||!((E=r.sourceToken)!=null&&E.decimals)||!b.bigNumber(r.sourceTokenAmount).gt(0),c=!r.sourceTokenAmount;return{networkAddress:n,fromAddress:o,fromCaipAddress:t,sourceTokenAddress:(F=r.sourceToken)==null?void 0:F.address,toTokenAddress:(L=r.toToken)==null?void 0:L.address,toTokenAmount:r.toTokenAmount,toTokenDecimals:(H=r.toToken)==null?void 0:H.decimals,sourceTokenAmount:r.sourceTokenAmount,sourceTokenDecimals:(Q=r.sourceToken)==null?void 0:Q.decimals,invalidToToken:i,invalidSourceToken:s,invalidSourceTokenAmount:c,availableToSwap:t&&!i&&!s&&!c,isAuthConnector:a===z.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e){r.sourceToken=e,r.sourceTokenAmount="",r.sourceTokenPriceInUSD=0;return}r.sourceToken=e,await u.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){r.sourceTokenAmount=e},async setToToken(e){if(!e){r.toToken=e,r.toTokenAmount="",r.toTokenPriceInUSD=0;return}r.toToken=e,await u.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){r.toTokenAmount=e?b.toFixed(e,Je):""},async setTokenPrice(e,t){let o=r.tokensPriceMap[e]||0;o||(r.loadingPrices=!0,o=await u.getAddressPrice(e)),t==="sourceToken"?r.sourceTokenPriceInUSD=o:t==="toToken"&&(r.toTokenPriceInUSD=o),r.loadingPrices&&(r.loadingPrices=!1),u.getParams().availableToSwap&&!r.switchingTokens&&u.swapTokens()},async switchTokens(){if(!(r.initializing||!r.initialized||r.switchingTokens)){r.switchingTokens=!0;try{const e=r.toToken?{...r.toToken}:void 0,t=r.sourceToken?{...r.sourceToken}:void 0,o=e&&r.toTokenAmount===""?"1":r.toTokenAmount;u.setSourceTokenAmount(o),u.setToTokenAmount(""),await u.setSourceToken(e),await u.setToToken(t),r.switchingTokens=!1,u.swapTokens()}catch(e){throw r.switchingTokens=!1,e}}},resetState(){r.myTokensWithBalance=S.myTokensWithBalance,r.tokensPriceMap=S.tokensPriceMap,r.initialized=S.initialized,r.initializing=S.initializing,r.switchingTokens=S.switchingTokens,r.sourceToken=S.sourceToken,r.sourceTokenAmount=S.sourceTokenAmount,r.sourceTokenPriceInUSD=S.sourceTokenPriceInUSD,r.toToken=S.toToken,r.toTokenAmount=S.toTokenAmount,r.toTokenPriceInUSD=S.toTokenPriceInUSD,r.networkPrice=S.networkPrice,r.networkTokenSymbol=S.networkTokenSymbol,r.networkBalanceInUSD=S.networkBalanceInUSD,r.inputError=S.inputError},resetValues(){var o;const{networkAddress:e}=u.getParams(),t=(o=r.tokens)==null?void 0:o.find(n=>n.address===e);u.setSourceToken(t),u.setToToken(void 0)},getApprovalLoadingState(){return r.loadingApprovalTransaction},clearError(){r.transactionError=void 0},async initializeState(){if(!r.initializing){if(r.initializing=!0,!r.initialized)try{await u.fetchTokens(),r.initialized=!0}catch{r.initialized=!1,v.showError("Failed to initialize swap"),p.goBack()}r.initializing=!1}},async fetchTokens(){var o;const{networkAddress:e}=u.getParams();await u.getNetworkTokenPrice(),await u.getMyTokensWithBalance();const t=(o=r.myTokensWithBalance)==null?void 0:o.find(n=>n.address===e);t&&(r.networkTokenSymbol=t.symbol,u.setSourceToken(t),u.setSourceTokenAmount("0"))},async getTokenList(){var t,o;const e=(t=f.state.activeCaipNetwork)==null?void 0:t.caipNetworkId;if(!(r.caipNetworkId===e&&r.tokens))try{r.tokensLoading=!0;const n=await Z.getTokenList(e);r.tokens=n,r.caipNetworkId=e,r.popularTokens=n.sort((d,w)=>d.symbol<w.symbol?-1:d.symbol>w.symbol?1:0);const i=(e&&((o=Te.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:o[e])||[]).map(d=>n.find(w=>w.symbol===d)).filter(d=>!!d),c=(Te.SWAP_SUGGESTED_TOKENS||[]).map(d=>n.find(w=>w.symbol===d)).filter(d=>!!d).filter(d=>!i.some(w=>w.address===d.address));r.suggestedTokens=[...i,...c]}catch{r.tokens=[],r.popularTokens=[],r.suggestedTokens=[]}finally{r.tokensLoading=!1}},async getAddressPrice(e){var d,w;const t=r.tokensPriceMap[e];if(t)return t;const o=await J.fetchTokenPrice({addresses:[e]}),n=(o==null?void 0:o.fungibles)||[],a=[...r.tokens||[],...r.myTokensWithBalance||[]],i=(d=a==null?void 0:a.find(g=>g.address===e))==null?void 0:d.symbol,s=((w=n.find(g=>g.symbol.toLowerCase()===(i==null?void 0:i.toLowerCase())))==null?void 0:w.price)||0,c=parseFloat(s.toString());return r.tokensPriceMap[e]=c,c},async getNetworkTokenPrice(){var a;const{networkAddress:e}=u.getParams(),o=(a=(await J.fetchTokenPrice({addresses:[e]}).catch(()=>(v.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:a[0],n=(o==null?void 0:o.price.toString())||"0";r.tokensPriceMap[e]=parseFloat(n),r.networkTokenSymbol=(o==null?void 0:o.symbol)||"",r.networkPrice=n},async getMyTokensWithBalance(e){const t=await Xe.getMyTokensWithBalance(e),o=Z.mapBalancesToSwapTokens(t);o&&(await u.getInitialGasPrice(),u.setBalances(o))},setBalances(e){const{networkAddress:t}=u.getParams(),o=f.state.activeCaipNetwork;if(!o)return;const n=e.find(a=>a.address===t);e.forEach(a=>{r.tokensPriceMap[a.address]=a.price||0}),r.myTokensWithBalance=e.filter(a=>a.address.startsWith(o.caipNetworkId)),r.networkBalanceInUSD=n?b.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var t,o;const e=await Z.fetchGasPrice();if(!e)return{gasPrice:null,gasPriceInUSD:null};switch((o=(t=f.state)==null?void 0:t.activeCaipNetwork)==null?void 0:o.chainNamespace){case z.CHAIN.SOLANA:return r.gasFee=e.standard??"0",r.gasPriceInUSD=b.multiply(e.standard,r.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(r.gasFee),gasPriceInUSD:Number(r.gasPriceInUSD)};case z.CHAIN.EVM:default:const n=e.standard??"0",a=BigInt(n),i=BigInt(We),s=j.getGasPriceInUSD(r.networkPrice,i,a);return r.gasFee=n,r.gasPriceInUSD=s,{gasPrice:a,gasPriceInUSD:s}}},async swapTokens(){var i,s,c;const e=(i=f.getAccountData())==null?void 0:i.address,t=r.sourceToken,o=r.toToken,n=b.bigNumber(r.sourceTokenAmount).gt(0);if(n||u.setToTokenAmount(""),!o||!t||r.loadingPrices||!n||!e)return;r.loadingQuote=!0;const a=b.bigNumber(r.sourceTokenAmount).times(10**t.decimals).round(0);try{const d=await J.fetchSwapQuote({userAddress:e,from:t.address,to:o.address,gasPrice:r.gasFee,amount:a.toString()});r.loadingQuote=!1;const w=(c=(s=d==null?void 0:d.quotes)==null?void 0:s[0])==null?void 0:c.toAmount;if(!w){te.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const g=b.bigNumber(w).div(10**o.decimals).toString();u.setToTokenAmount(g),u.hasInsufficientToken(r.sourceTokenAmount,t.address)?r.inputError="Insufficient balance":(r.inputError=void 0,u.setTransactionDetails())}catch(d){const w=await Z.handleSwapError(d);r.loadingQuote=!1,r.inputError=w||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=u.getParams(),o=r.sourceToken,n=r.toToken;if(!(!e||!t||!o||!n||r.loadingQuote))try{r.loadingBuildTransaction=!0;const a=await Z.fetchSwapAllowance({userAddress:e,tokenAddress:o.address,sourceTokenAmount:r.sourceTokenAmount,sourceTokenDecimals:o.decimals});let i;return a?i=await u.createSwapTransaction():i=await u.createAllowanceTransaction(),r.loadingBuildTransaction=!1,r.fetchError=!1,i}catch{p.goBack(),v.showError("Failed to check allowance"),r.loadingBuildTransaction=!1,r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:e,sourceTokenAddress:t,toTokenAddress:o}=u.getParams();if(!(!e||!o)){if(!t)throw new Error("createAllowanceTransaction - No source token address found.");try{const n=await J.generateApproveCalldata({from:t,to:o,userAddress:e}),a=ye.getPlainAddress(n.tx.from);if(!a)throw new Error("SwapController:createAllowanceTransaction - address is required");const i={data:n.tx.data,to:a,gasPrice:BigInt(n.tx.eip155.gasPrice),value:BigInt(n.tx.value),toAmount:r.toTokenAmount};return r.swapTransaction=void 0,r.approvalTransaction={data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount},{data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount}}catch{p.goBack(),v.showError("Failed to create approval transaction"),r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}}},async createSwapTransaction(){var s;const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:o}=u.getParams(),n=r.sourceToken,a=r.toToken;if(!t||!o||!n||!a)return;const i=(s=de.parseUnits(o,n.decimals))==null?void 0:s.toString();try{const c=await J.generateSwapCalldata({userAddress:t,from:n.address,to:a.address,amount:i,disableEstimate:!0}),d=n.address===e,w=BigInt(c.tx.eip155.gas),g=BigInt(c.tx.eip155.gasPrice),P=ye.getPlainAddress(c.tx.to);if(!P)throw new Error("SwapController:createSwapTransaction - address is required");const E={data:c.tx.data,to:P,gas:w,gasPrice:g,value:BigInt(d?i??"0":"0"),toAmount:r.toTokenAmount};return r.gasPriceInUSD=j.getGasPriceInUSD(r.networkPrice,w,g),r.approvalTransaction=void 0,r.swapTransaction=E,E}catch{p.goBack(),v.showError("Failed to create transaction"),r.approvalTransaction=void 0,r.swapTransaction=void 0,r.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){v.showLoading("Approve limit increase in your wallet"),p.replace("SwapPreview")},async sendTransactionForApproval(e){var a,i,s;const{fromAddress:t,isAuthConnector:o}=u.getParams();r.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";o?p.pushTransactionStack({onSuccess:u.onEmbeddedWalletApprovalSuccess}):v.showLoading(n);try{await de.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:z.CHAIN.EVM}),await u.swapTokens(),await u.getTransaction(),r.approvalTransaction=void 0,r.loadingApprovalTransaction=!1}catch(c){const d=c;r.transactionError=d==null?void 0:d.displayMessage,r.loadingApprovalTransaction=!1,v.showError((d==null?void 0:d.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(d==null?void 0:d.displayMessage)||(d==null?void 0:d.message)||"Unknown",network:((a=f.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)||"",swapFromToken:((i=u.state.sourceToken)==null?void 0:i.symbol)||"",swapToToken:((s=u.state.toToken)==null?void 0:s.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(e){var s,c,d,w,g,P,E,F,L,H,Q,Ee;if(!e)return;const{fromAddress:t,toTokenAmount:o,isAuthConnector:n}=u.getParams();r.loadingTransaction=!0;const a=`Swapping ${(s=r.sourceToken)==null?void 0:s.symbol} to ${b.formatNumberToLocalString(o,3)} ${(c=r.toToken)==null?void 0:c.symbol}`,i=`Swapped ${(d=r.sourceToken)==null?void 0:d.symbol} to ${b.formatNumberToLocalString(o,3)} ${(w=r.toToken)==null?void 0:w.symbol}`;n?p.pushTransactionStack({onSuccess(){p.replace("Account"),v.showLoading(a),we.resetState()}}):v.showLoading("Confirm transaction in your wallet");try{const ve=[(g=r.sourceToken)==null?void 0:g.address,(P=r.toToken)==null?void 0:P.address].join(","),$=await de.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:z.CHAIN.EVM});return r.loadingTransaction=!1,v.showSuccess(i),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((E=f.state.activeCaipNetwork)==null?void 0:E.caipNetworkId)||"",swapFromToken:((F=u.state.sourceToken)==null?void 0:F.symbol)||"",swapToToken:((L=u.state.toToken)==null?void 0:L.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}}),we.resetState(),n||p.replace("Account"),we.getMyTokensWithBalance(ve),$}catch(ve){const $=ve;r.transactionError=$==null?void 0:$.displayMessage,r.loadingTransaction=!1,v.showError(($==null?void 0:$.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:($==null?void 0:$.displayMessage)||($==null?void 0:$.message)||"Unknown",network:((H=f.state.activeCaipNetwork)==null?void 0:H.caipNetworkId)||"",swapFromToken:((Q=u.state.sourceToken)==null?void 0:Q.symbol)||"",swapToToken:((Ee=u.state.toToken)==null?void 0:Ee.symbol)||"",swapFromAmount:u.state.sourceTokenAmount||"",swapToAmount:u.state.toTokenAmount||"",isSmartAccount:ue(z.CHAIN.EVM)===pe.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(e,t){return j.isInsufficientSourceTokenForSwap(e,t,r.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=u.getParams();!e||!t||(r.gasPriceInUSD=j.getGasPriceInUSD(r.networkPrice,BigInt(r.gasFee),BigInt(We)),r.priceImpact=j.getPriceImpact({sourceTokenAmount:r.sourceTokenAmount,sourceTokenPriceInUSD:r.sourceTokenPriceInUSD,toTokenPriceInUSD:r.toTokenPriceInUSD,toTokenAmount:r.toTokenAmount}),r.maxSlippage=j.getMaxSlippage(r.slippage,r.toTokenAmount),r.providerFee=j.getProviderFee(r.sourceTokenAmount))}},u=Be(we),W=_e({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),et={state:W,subscribe(e){return Ue(W,()=>e(W))},subscribeKey(e,t){return ze(W,e,t)},showTooltip({message:e,triggerRect:t,variant:o}){W.open=!0,W.message=e,W.triggerRect=t,W.variant=o},hide(){W.open=!1,W.message="",W.triggerRect={width:0,height:0,top:0,left:0}}},ee=Be(et),Me={isUnsupportedChainView(){return p.state.view==="UnsupportedChain"||p.state.view==="SwitchNetwork"&&p.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){R.shake();return}if(await Fe.isSIWXCloseDisabled()){R.shake();return}(p.state.view==="DataCapture"||p.state.view==="DataCaptureOtpConfirm")&&de.disconnect(),R.close()}},tt=A`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px);
|
package/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/x-icon" href="https://cdn.decentraland.org/@dcl/governance-site/
|
|
5
|
+
<link rel="icon" type="image/x-icon" href="https://cdn.decentraland.org/@dcl/governance-site/2.0.0/favicon.ico" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<link
|
|
8
8
|
href="https://fonts.googleapis.com/css?family=Inconsolata&display=swap"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
title="Sitemap"
|
|
15
15
|
href="/sitemap.xml"
|
|
16
16
|
/>
|
|
17
|
-
<link rel="manifest" href="https://cdn.decentraland.org/@dcl/governance-site/
|
|
17
|
+
<link rel="manifest" href="https://cdn.decentraland.org/@dcl/governance-site/2.0.0/manifest.json" />
|
|
18
18
|
<meta name="theme-color" content="#000000" />
|
|
19
19
|
<title>Decentraland DAO</title>
|
|
20
20
|
<meta name="description" content="The governance hub for Decentraland. Create and vote on proposals that help shape the future of the metaverse." />
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
<meta property="twitter:description" content="The governance hub for Decentraland. Create and vote on proposals that help shape the future of the metaverse." >
|
|
26
26
|
<meta property="twitter:image" content="https://decentraland.org/images/decentraland.png" >
|
|
27
27
|
<meta property="twitter:card" content="summary" >
|
|
28
|
-
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/governance-site/
|
|
29
|
-
<link rel="stylesheet" href="https://cdn.decentraland.org/@dcl/governance-site/
|
|
28
|
+
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/governance-site/2.0.0/assets/index-2ef9f1d1.js"></script>
|
|
29
|
+
<link rel="stylesheet" href="https://cdn.decentraland.org/@dcl/governance-site/2.0.0/assets/index-a8255d1c.css">
|
|
30
30
|
</head>
|
|
31
31
|
<body>
|
|
32
32
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/governance-site",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Governance website",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/decentraland/governance-ui.git"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://cdn.decentraland.org/@dcl/governance-site/
|
|
20
|
+
"homepage": "https://cdn.decentraland.org/@dcl/governance-site/2.0.0",
|
|
21
21
|
"commit": "ad8dc42a6f9b4eae3e8571449097a08800dade1b"
|
|
22
22
|
}
|