|
|
|
|
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[516],{7133:function(e,n,r){"use strict";r.r(n),r.d(n,{SignMessage:function(){return f}});var s=r(7891),t=r(7838),o=r(9980),a=r(9560),c=r(5593),i=r(697),u=r.n(i),l=r(2363),d=r(8052),g=r(4675),f=function(){var e=(0,c.O)(),n=e.publicKey,r=e.signMessage,i=(0,g.d)(),f=(0,l.useCallback)((0,s.Z)((function(){var e,s,o;return(0,t.__generator)(this,(function(t){switch(t.label){case 0:if(t.trys.push([0,2,,3]),!n)throw new Error("Wallet not connected!");if(!r)throw new Error("Wallet does not support message signing!");return e=(new TextEncoder).encode("Hello, world!"),[4,r(e)];case 1:if(s=t.sent(),!d.sign.detached.verify(e,s,n.toBytes()))throw new Error("Invalid signature!");return i("success","Message signature: ".concat(u().encode(s))),[3,3];case 2:return o=t.sent(),i("error","Signing failed: ".concat(null===o||void 0===o?void 0:o.message)),[3,3];case 3:return[2]}}))})),[n,i,r]);return r?(0,o.jsx)(a.Z,{variant:"contained",color:"secondary",onClick:f,disabled:!n,children:"Sign Message"}):null}},6510:function(){}}]);
|