File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @devprotocol/clubs-plugin-posts" ,
3- "version" : " 0.20.10 " ,
3+ "version" : " 0.20.11 " ,
44 "type" : " module" ,
55 "description" : " Template repository for using TypeScript" ,
66 "main" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -108,14 +108,22 @@ const testPermission = async (
108108}
109109
110110const handleConnection = async (signer : UndefinedOr <Signer >) => {
111+ let newSigner: Signer = signer as Signer
112+ console .log ({ signer })
111113 if (! signer ) {
112- return
114+ const { connection : conct } = await import (
115+ ' @devprotocol/clubs-core/connection'
116+ )
117+ connection .value = conct
118+ newSigner = conct ().signer .value
119+ console .log ({ newSigner })
113120 }
114-
121+ console . log ( ' inside Handle Connection ' )
115122 // get wallet address
116- const connectedAddress = await signer .getAddress ()
123+ const connectedAddress = signer ? await signer . getAddress () : await newSigner .getAddress ()
117124 // const connectedAddress = '0x57E21bd98612DE0Bd1723F4bf81A944eF7BfF526'
118125 walletAddress .value = connectedAddress
126+ console .log ({ connectedAddress })
119127
120128 const hash = getMessage (connectedAddress )
121129
@@ -176,11 +184,16 @@ onMounted(async () => {
176184 walletSigner = signer
177185 })
178186 const signer = conct ().signer .value
187+ console .log ({signer })
188+ console .log ({walletSigner })
179189 if (signer ) {
180190 const connectedAddress = await signer .getAddress ()
181191 walletAddress .value = connectedAddress
182192 isVerified .value = true
183193 }
194+ setTimeout (() => {
195+ handleConnection (walletSigner )
196+ }, 1000 )
184197
185198 i18n .value = i18nBase (navigator .languages )
186199})
Original file line number Diff line number Diff line change 22import { type UndefinedOr } from '@devprotocol/util-ts'
33import { type Signer } from 'ethers'
44import { encode , decode } from '@devprotocol/clubs-core'
5+ import { verifyMessage } from 'ethers'
56
67const maxValidity = 1 * 60 * 60 * 1000 // 1 hour
78
@@ -38,6 +39,14 @@ export const getSignature = async (
3839 return decode ( sig ) as string
3940}
4041
42+ export const getSessionAddress = async (
43+ hash : string ,
44+ sig : string ,
45+ ) => {
46+ const address = verifyMessage ( hash , sig )
47+ return address
48+ }
49+
4150export const consoleWarn = ( ) => {
4251 console . log ( '%cWarning!!' , 'color: red; font-size: 20px; background: yellow;' )
4352 console . log (
You can’t perform that action at this time.
0 commit comments