@@ -135,6 +135,103 @@ export default function App() {
135135 uiConsole ( message ) ;
136136 } ;
137137
138+ const requestSignature = async ( ) => {
139+ if ( ! web3auth ) {
140+ setConsole ( "Web3auth not initialized" ) ;
141+ return ;
142+ }
143+ if ( ! key ) {
144+ setConsole ( "User not logged in" ) ;
145+ return ;
146+ }
147+
148+ const address = await RPC . getAccounts ( key ) ;
149+
150+ // const params = [
151+ // {
152+ // challenge: 'Hello World',
153+ // address,
154+ // },
155+ // null,
156+ // ];
157+ const params = [ "Hello World" , address ] ;
158+ // const params = [{ }];
159+ // params.push('Hello World');
160+ // params.push(address);
161+
162+ // const params = [
163+ // address,
164+ // {
165+ // types: {
166+ // EIP712Domain: [
167+ // {
168+ // name: 'name',
169+ // type: 'string',
170+ // },
171+ // {
172+ // name: 'version',
173+ // type: 'string',
174+ // },
175+ // {
176+ // name: 'chainId',
177+ // type: 'uint256',
178+ // },
179+ // {
180+ // name: 'verifyingContract',
181+ // type: 'address',
182+ // },
183+ // ],
184+ // Person: [
185+ // {
186+ // name: 'name',
187+ // type: 'string',
188+ // },
189+ // {
190+ // name: 'wallet',
191+ // type: 'address',
192+ // },
193+ // ],
194+ // Mail: [
195+ // {
196+ // name: 'from',
197+ // type: 'Person',
198+ // },
199+ // {
200+ // name: 'to',
201+ // type: 'Person',
202+ // },
203+ // {
204+ // name: 'contents',
205+ // type: 'string',
206+ // },
207+ // ],
208+ // },
209+ // primaryType: 'Mail',
210+ // domain: {
211+ // name: 'Ether Mail',
212+ // version: '1',
213+ // chainId: chainConfig.chainId,
214+ // verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
215+ // },
216+ // message: {
217+ // from: {
218+ // name: 'Cow',
219+ // wallet: address,
220+ // },
221+ // to: {
222+ // name: 'Bob',
223+ // wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
224+ // },
225+ // contents: 'Hello, Bob!',
226+ // },
227+ // },
228+ // ];
229+
230+ setConsole ( "Request Signature" ) ;
231+ const res = await web3auth . request ( chainConfig , "personal_sign" , params ) ;
232+ uiConsole ( res ) ;
233+ } ;
234+
138235 const uiConsole = ( ...args ) => {
139236 setConsole ( `${ JSON . stringify ( args || { } , null , 2 ) } \n\n\n\n${ console } ` ) ;
140237 } ;
@@ -144,6 +241,7 @@ export default function App() {
144241 < Button title = "Get User Info" onPress = { ( ) => uiConsole ( userInfo ) } />
145242 < Button title = "Enable MFA" onPress = { ( ) => enableMFA ( ) } />
146243 < Button title = "launch Wallet Services" onPress = { ( ) => launchWalletSerices ( ) } />
244+ < Button title = "Request Signature" onPress = { ( ) => requestSignature ( ) } />
147245 < Button title = "Get Chain ID" onPress = { getChainId } />
148246 < Button title = "Get Accounts" onPress = { getAccounts } />
149247 < Button title = "Get Balance" onPress = { getBalance } />
0 commit comments