@@ -15,6 +15,7 @@ import {
15
15
TezosGetAccountResponse
16
16
} from './utils/helpers'
17
17
import { SAMPLE_KINDS , SAMPLES } from './utils/samples'
18
+ import { ErrorObject } from '@walletconnect/utils'
18
19
19
20
const projectId = import . meta. env . VITE_PROJECT_ID
20
21
@@ -31,7 +32,7 @@ const App = () => {
31
32
const [ isConnected , setIsConnected ] = useState ( false )
32
33
const [ lastKind , setLastKind ] = useState < SAMPLE_KINDS | undefined > ( undefined )
33
34
const [ result , setResult ] = useState <
34
- TezosSendResponse | TezosSignResponse | TezosGetAccountResponse | string | null
35
+ TezosSendResponse | TezosSignResponse | TezosGetAccountResponse | ErrorObject | string | null
35
36
> ( null )
36
37
const [ description , setDescription ] = useState < Record < string , unknown > | string | undefined > (
37
38
undefined
@@ -132,7 +133,9 @@ const App = () => {
132
133
if ( provider ) {
133
134
await provider . disconnect ( )
134
135
setIsConnected ( false )
135
- setResult ( null ) // Clear result on disconnect
136
+ setResult ( null )
137
+ setContractAddress ( '[click Origination to get contract address]' )
138
+ setBalance ( '' )
136
139
}
137
140
} , [ provider ] )
138
141
@@ -170,7 +173,7 @@ const App = () => {
170
173
SAMPLES [ kind ]
171
174
)
172
175
console . log ( 'TezosRpc origination result: ' , res )
173
- for ( let attempt = 0 ; attempt < 5 ; attempt ++ ) {
176
+ for ( let attempt = 0 ; attempt < 10 ; attempt ++ ) {
174
177
const contractAddressList = await apiGetContractAddress (
175
178
TezosChainData [ 'testnet' ] . id ,
176
179
res . hash
@@ -212,7 +215,7 @@ const App = () => {
212
215
await getBalance ( )
213
216
} catch ( error ) {
214
217
console . error ( `Error sending ${ kind } :` , error )
215
- setResult ( JSON . stringify ( error , null , 2 ) )
218
+ setResult ( error as ErrorObject )
216
219
}
217
220
} ,
218
221
[ provider , address ]
@@ -225,7 +228,7 @@ const App = () => {
225
228
}
226
229
} , [ address ] )
227
230
228
- const describe = useCallback ( ( kind : SAMPLE_KINDS ) => {
231
+ const describe = ( kind : SAMPLE_KINDS ) => {
229
232
switch ( kind ) {
230
233
case SAMPLE_KINDS . SEND_TRANSACTION :
231
234
case SAMPLE_KINDS . SEND_DELEGATION :
@@ -247,11 +250,11 @@ const App = () => {
247
250
default :
248
251
setDescription ( 'No description available' )
249
252
}
250
- } , [ ] )
253
+ }
251
254
252
- const describeClear = useCallback ( ( ) => {
255
+ const describeClear = ( ) => {
253
256
setDescription ( undefined )
254
- } , [ ] )
257
+ }
255
258
256
259
return (
257
260
< div className = "App" >
@@ -274,6 +277,9 @@ const App = () => {
274
277
< p >
275
278
< b > Balance:</ b > { balance }
276
279
</ p >
280
+ < p >
281
+ < b > Contract Address:</ b > { contractAddress }
282
+ </ p >
277
283
< div className = "layout-container" >
278
284
< div className = "btn-container" >
279
285
< button onClick = { disconnect } onMouseEnter = { describeClear } >
0 commit comments