PageSourceSearch

https://ethers-chainstackprovider-demo-nextjs.vercel.app/_next/static/chunks/app/page-7ad8c912484c390b.js

js ethers-chainstackprovider-demo-nextjs.vercel.app collected 2026-10-03 06:54:34 UTC 10,818 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5674:function(t,e,r){Promise.resolve().then(r.bind(r,4633))},4633:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return W}});var n=r(7437),s=r(2265);function i(t){if(!Number.isSafeInteger(t)||t<0)throw Error(`Wrong positive integer: ${t}`)}function o(t,...e){if(!(t instanceof Uint8Array))throw Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function a(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}let l=BigInt(4294967296-1),h=BigInt(32),u=(t,e,r)=>t<<r|e>>>32-r,c=(t,e,r)=>e<<r|t>>>32-r,f=(t,e,r)=>e<<r-32|t>>>64-r,d=(t,e,r)=>t<<r-32|e>>>64-r,g=t=>t instanceof Uint8Array,p=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function b(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}(t)),!g(t))throw Error(`expected Uint8Array, got ${typeof t}`);return t}class y{clone(){return this._cloneInto()}}let[m,w,x]=[[],[],[]],k=BigInt(0),E=BigInt(1),N=BigInt(2),A=BigInt(7),j=BigInt(256),I=BigInt(113);for(let t=0,e=E,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],m.push(2*(5*n+r)),w.push((t+1)*(t+2)/2%64);let s=k;for(let t=0;t<7;t++)(e=(e<<E^(e>>A)*I)%j)&N&&(s^=E<<(E<<BigInt(t))-E);x.push(s)}let[U,v]=function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let s=0;s<t.length;s++){let{h:i,l:o}=function(t,e=!1){return e?{h:Number(t&l),l:Number(t>>h&l)}:{h:0|Number(t>>h&l),l:0|Number(t&l)}}(t[s],e);[r[s],n[s]]=[i,o]}return[r,n]}(x,!0),C=(t,e,r)=>r>32?f(t,e,r):u(t,e,r),O=(t,e,r)=>r>32?d(t,e,r):c(t,e,r);class F extends y{constructor(t,e,r,n=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,i(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=p(this.state)}keccak(){!function(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let e=0;e<10;e++)r[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){let n=(e+8)%10,s=(e+2)%10,i=r[s],o=r[s+1],a=C(i,o,1)^r[n],l=O(i,o,1)^r[n+1];for(let r=0;r<50;r+=10)t[e+r]^=a,t[e+r+1]^=l}let e=t[2],s=t[3];for(let r=0;r<24;r++){let n=w[r],i=C(e,s,n),o=O(e,s,n),a=m[r];e=t[a],s=t[a+1],t[a]=i,t[a+1]=o}for(let e=0;e<50;e+=10){for(let n=0;n<10;n++)r[n]=t[e+n];for(let n=0;n<10;n++)t[e+n]^=~r[(n+2)%10]&r[(n+4)%10]}t[0]^=U[n],t[1]^=v[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){a(this);let{blockLen:e,state:r}=this,n=(t=b(t)).length;for(let s=0;s<n;){let i=Math.min(e-this.pos,n-s);for(let e=0;e<i;e++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,(128&e)!=0&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){a(this,!1),o(t),this.finish();let e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return t}xofInto(t){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return i(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(!function(t,e){o(t);let r=e.outputLen;if(t.length<r)throw Error(`digestInto() expects output buffer of length at least ${r}`)}(t,this),this.finished)throw Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return t||(t=new F(e,r,n,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=i,t.destroyed=this.destroyed,t}}let S=function(t){let e=e=>t().update(b(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}(()=>new F(136,1,32));function B(t,e,r){for(let n in e){let s=e[n],i=r?r[n]:null;i&&function(t,e,r){let n=e.split("|").map(t=>t.trim());for(let r=0;r<n.length;r++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}let s=Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${r}`,s.value=t,s}(s,i,n),Object.defineProperty(t,n,{enumerable:!0,value:s,writable:!1})}}function L(t){if(null==t)return"null";if(Array.isArray(t))return"[ "+t.map(L).join(", ")+" ]";if(t instanceof Uint8Array){let e="0123456789abcdef",r="0x";for(let n=0;n<t.length;n++)r+=e[t[n]>>4]+e[15&t[n]];return r}if("object"==typeof t&&"function"==typeof t.toJSON)return L(t.toJSON());switch(typeof t){case"boolean":case"symbol":case"number":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{let e=Object.keys(t);return e.sort(),"{ "+e.map(e=>`${L(e)}: ${L(t[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function T(t,e,r,n){!function(t,e,r,n){if(!t)throw function(t,e,r){let n,s=t;{let n=[];if(r){if("message"in r||"code"in r||"name"in r)throw Error(`value will over
1write populated values: ${L(r)}`);for(let t in r){if("shortMessage"===t)continue;let e=r[t];n.push(t+"="+L(e))}}n.push(`code=${e}`),n.push("version=6.12.1"),n.length&&(t+=" ("+n.join(", ")+")")}switch(e){case"INVALID_ARGUMENT":n=TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=RangeError(t);break;default:n=Error(t)}return B(n,{code:e}),r&&Object.assign(n,r),null==n.shortMessage&&B(n,{shortMessage:s}),n}(e,r,n)}(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function $(t,e){return function(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if("string"==typeof t&&t.match(/^0x([0-9a-f][0-9a-f])*$/i)){let e=new Uint8Array((t.length-2)/2),r=2;for(let n=0;n<e.length;n++)e[n]=parseInt(t.substring(r,r+2),16),r+=2;return e}T(!1,"invalid BytesLike value",e||"value",t)}(t,e,!1)}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test"!=="test".normalize(e))throw Error("bad");if("NFD"===e){let t=String.fromCharCode(233).normalize("NFD"),e=String.fromCharCode(101,769);if(t!==e)throw Error("broken")}t.push(e)}catch(t){}return t},[]);let _="0123456789abcdef",M=!1,D=function(t){return S(t)},R=D;function P(t){let e=$(t,"data");return function(t){let e=$(t),r="0x";for(let t=0;t<e.length;t++){let n=e[t];r+=_[(240&n)>>4]+_[15&n]}return r}(R(e))}P._=D,P.lock=function(){M=!0},P.register=function(t){if(M)throw TypeError("keccak256 is locked");R=t},Object.freeze(P);let z=BigInt(0),X=BigInt(36);function H(t){let e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);let n=$(P(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}let J={};for(let t=0;t<10;t++)J[String(t)]=String(t);for(let t=0;t<26;t++)J[String.fromCharCode(65+t)]=String(10+t);let V=function(){let t={};for(let e=0;e<36;e++)t["0123456789abcdefghijklmnopqrstuvwxyz"[e]]=BigInt(e);return t}();function W(){let[t,e]=(0,s.useState)(""),[r,i]=(0,s.useState)(null),[o,a]=(0,s.useState)(!1),[l,h]=(0,s.useState)(null),u=async()=>{if(!function(t){try{return!function(t){if(T("string"==typeof t,"invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);let e=H(t);return T(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t)}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){T(t.substring(2,4)===function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>J[t]).join("");for(;e.length>=15;){let t=e.substring(0,15);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t),"bad icap checksum","address",t);let e=(function(t){t=t.toLowerCase();let e=z;for(let r=0;r<t.length;r++)e=e*X+V[t[r]];return e})(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return H("0x"+e)}T(!1,"invalid address","address",t)}(t),!0}catch(t){}return!1}(t)){h("Invalid Ethereum address");return}a(!0),h(null),i(null);try{let e=await fetch("/api/balances",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t})});if(!e.ok)throw Error("Failed to fetch balances");let r=await e.json();i(r)}catch(t){h(t.message)}a(!1)};return(0,n.jsxs)("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gray-900 text-white py-4",children:[(0,n.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Chainstack Powered"}),(0,n.jsx)("h2",{className:"text-2xl mb-4",children:"Multi-chain Wallet Balance Aggregator"}),(0,n.jsxs)("h3",{className:"text-lg mb-4",children:["This simple DApp uses the ",(0,n.jsx)("code",{children:"ChainstackProvider"})," from ether.js to interact with those chains."]}),(0,n.jsxs)("h4",{className:"text-lg mb-4",children:["Learn more about the ",(0,n.jsx)("code",{children:"ChainstackProvider"})," from ether.js on the"," ",(0,n.jsx)("a",{href:"https://docs.chainstack.com/reference/ethersjs-chainstackprovider",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:"Chainstack documentation"}),"."]}),(0,n.jsxs)("div",{className:"w-full max-w-md bg-gray-800 p-6 rounded-lg shadow-md",children:[(0,n.jsx)("input",{type:"text",placeholder:"Enter Wallet Address",value:t,onChange:t=>e(t.target.value),className:"w-full p-2 mb-4 border rounded bg-gray-700 border-gray-600 text-white"}),(0,n.jsx)("button",{onClick:u,className:"w-full p-2 bg-blue-500 text-white rounded hover:bg-blue-600",disabled:!t||o,children:o?"Checking...":"Check Balances"}),l&&(0,n.jsx)("p",{className:"text-red-500 mt-4",children:l}),r&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Ethereum:"})," ",parseFloat(r.ethereum).toFixed(5)," ETH"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Polygon:"})," ",parseFloat(r.polygon).toFixed(5)," MATIC"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"BNB Smart Chain:"})," ",parseFloat(r.bnb).toFixed(5)," BNB"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Arbitrum:"})," ",parseFloat(r.arbitrum).toFixed(5)," ETH"]})]})]})]})}}},function(t){t.O(0,[971,23,744],function(){return t(t.s=5674)}),_N_E=t.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.