text: (this["webpackJsonpbuildspace-solana"]=this["webpackJsonpbuildspace-solana"]||[]).push([[0],{101:function(e){e.exports=JSON.parse('{"_keypair":{"publicKey":{"0":198,"1":135,"2":191,"3":193,"4":84,"5":40,"6":10,"7":0,"8":118,"9":37,"10":4,"11":209,"12":20,"13":15,"14":238,"15":167,"16":102,"17":63,"18":51,"19":8,"20":51,"21":145,"22":170,"23":90,"24":62,"25":82,"26":144,"27":116,"28":139,"29":39,"30":131,"31":192},"secretKey":{"0":96,"1":246,"2":67,"3":117,"4":50,"5":134,"6":72,"7":6,"8":106,"9":7,"10":68,"11":188,"12":151,"13":15,"14":117,"15":218,"16":247,"17":223,"18":134,"19":11,"20":20,"21":138,"22":24,"23":70,"24":205,"25":84,"26":144,"27":220,"28":229,"29":8,"30":42,"31":236,"32":198,"33":135,"34":191,"35":193,"36":84,"37":40,"38":10,"39":0,"40":118,"41":37,"42":4,"43":209,"44":20,"45":15,"46":238,"47":167,"48":102,"49":63,"50":51,"51":8,"52":51,"53":145,"54":170,"55":90,"56":62,"57":82,"58":144,"59":116,"60":139,"61":39,"62":131,"63":192}}}')},110:function(e,t,n){},111:function(e,t,n){},112:function(e,t){},115:function(e,t){},144:function(e,t){},145:function(e,t){},169:function(e,t,n){"use strict";n.r(t);var c=n(24),r=n.n(c),a=n(100),s=n.n(a),o=(n(110),n(1)),i=n.n(o),u=n(3),l=n(9),p=n(49),f=n(101),d=n.p+"static/media/twitter-logo.d89d9a86.svg",b=(n(111),n(8)),m=n(25),g=n(15),j=m.d.SystemProgram,h=(m.d.Keypair,Object.values(f._keypair.secretKey)),y=new Uint8Array(h),x=m.d.Keypair.fromSecretKey(y),v=new b.PublicKey(p.metadata.address),w=Object(b.clusterApiUrl)("devnet"),O="processed",k="thryec",S="https://twitter.com/".concat(k),K=function(){var e=Object(c.useState)(null),t=Object(l.a)(e,2),n=t[0],r=t[1],a=Object(c.useState)(""),s=Object(l.a)(a,2),o=s[0],f=s[1],h=Object(c.useState)([]),y=Object(l.a)(h,2),K=y[0],N=y[1],A=function(){var e=Object(u.a)(i.a.mark((function e(){var t,n,c;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=window,!(n=t.solana)){e.next=12;break}if(!n.isPhantom){e.next=10;break}return console.log("Phantom wallet found!"),e.next=7,n.connect({onlyIfTrusted:!0});case 7:c=e.sent,console.log("Connected with Public Key: ",c.publicKey.toString()),r(c.publicKey.toString());case 10:e.next=13;break;case 12:alert("Solana object not found! Please download the Phantom wallet :)");case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.error(e.t0);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),G=function(){var e=Object(u.a)(i.a.mark((function e(){var t,n,c;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=window,!(n=t.solana)){e.next=7;break}return e.next=4,n.connect();case 4:c=e.sent,console.log("Connected with Public Key: ",c.publicKey.toString()),r(c.publicKey.toString());case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),P=function(e){var t=e.target.value;f(t)},I=function(){var e=new b.Connection(w,O);return new m.b(e,window.solana,O)},E=function(){var e=Object(u.a)(i.a.mark((function e(){var t,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=I(),n=new m.a(p,v,t),console.log("ping"),e.next=6,n.rpc.startStuffOff({accounts:{baseAccount:x.publicKey,user:t.wallet.publicKey,systemProgram:j.programId},signers:[x]});case 6:return console.log("Created a new BaseAccount w/ address:",x.publicKey.toString()),e.next=9,L();case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.log("Error creating BaseAccount account:",e.t0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=Object(u.a)(i.a.mark((function e(){var t,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==o.length){e.next=3;break}return console.log("No gif link given!"),e.abrupt("return");case 3:return console.log("Gif link: ",o),e.prev=4,t=I(),n=new m.a(p,v,t),e.next=9,n.rpc.addGif(o,{accounts:{baseAccount:x.publicKey,user:t.wallet.publicKey}});case 9:return console.log("GIF sucesfully sent to program",o),e.next=12,L();case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),console.log("Error sending GIF:",e.t0);case 17:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=Object(u.a)(i.a.mark((function e(){var t,n,c;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=I(),n=new m.a(p,v,t),e.next=5,n.account.baseAccount.fetch(x.publicKey);case 5:c=e.sent,console.log("Got the account",c),N(c.gifList),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.log("Error in getGifs: ",e.t0),N(null);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();return Object(c.useEffect)((function(){window.addEventListener("load",Object(u.a)(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A();case 2:case"end":return e.stop()}}),e)}))))}),[]),Object(c.useEffect)((function(){n&&(console.log("Fetching GIF list..."),L())}),[n]),Object(g.jsx)("div",{className:"App",children:Object(g.jsxs)("div",{className:n?"authed-container":"container",children:[Object(g.jsxs)("div",{className:"header-container",children:[Object(g.jsx)("p",{className:"header",children:"Art Blocks Gallery"}),Object(g.jsx)("p",{className:"sub-text",children:"View your Art Blocks collection in the metaverse \u2728"}),Object(g.jsxs)("div",{className:"test",children:[!n&&Object(g.jsx)("button",{className:"cta-button connect-wallet-button",onClick:G,children:"Connect to Wallet"}),n&&(null===K?Object(g.jsx)("div",{className:"connected-container",children:Object(g.jsx)("button",{className:"cta-button submit-gif-button",onClick:E,children:"Do One-Time Initialization For GIF Program Account"})}):Object(g.jsxs)("div",{className:"connected-container",children:[Object(g.jsxs)("form",{onSubmit:function(e){e.preventDefault(),C()},children:[Object(g.jsx)("input",{type:"text",placeholder:"Enter gif link!",value:o,onChange:P}),Object(g.jsx)("button",{type:"submit",className:"cta-button submit-gif-button",children:"Submit"})]}),Object(g.jsx)("div",{className:"gif-grid",children:K.map((function(e,t){return Object(g.jsx)("div",{className:"gif-item",children:Object(g.jsx)("img",{src:e.gifLink})},t)}))})]}))]})]}),Object(g.jsxs)("div",{className:"footer-container",children:[Object(g.jsx)("img",{alt:"Twitter Logo",className:"twitter-logo",src:d}),Object(g.jsx)("a",{className:"footer-text",href:S,target:"_blank",rel:"noreferrer",children:"built by @".concat(k)})]})]})})};s.a.render(Object(g.jsx)(r.a.StrictMode,{children:Object(g.jsx)(K,{})}),document.getElementById("root"))},49:function(e){e.exports=JSON.parse('{"version":"0.0.0","name":"myepicproject","instructions":[{"name":"startStuffOff","accounts":[{"name":"baseAccount","isMut":true,"isSigner":true},{"name":"user","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"addGif","accounts":[{"name":"baseAccount","isMut":true,"isSigner":false},{"name":"user","isMut":true,"isSigner":true}],"args":[{"name":"gifLink","type":"string"}]}],"accounts":[{"name":"BaseAccount","type":{"kind":"struct","fields":[{"name":"totalGifs","type":"u64"},{"name":"gifList","type":{"vec":{"defined":"ItemStruct"}}}]}}],"types":[{"name":"ItemStruct","type":{"kind":"struct","fields":[{"name":"gifLink","type":"string"},{"name":"userAddress","type":"publicKey"}]}}],"metadata":{"address":"EJdVHb1ipppSyrkay9dXY5jMV8xnkTyKYgVQud5Q7cjD"}}')}},[[169,1,2]]]);
  //# sourceMappingURL=main.7983ddea.chunk.js.map