Skip to content

Commit 117d770

Browse files
feat: contractAddress shown for better UX
1 parent d7c3cb7 commit 117d770

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dapps/tezos-provider/src/App.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TezosSendResponse,
1111
TezosSignResponse,
1212
} from "./utils/tezos-provider";
13+
import { ErrorObject } from '@walletconnect/utils';
1314

1415
const projectId = import.meta.env.VITE_PROJECT_ID;
1516

@@ -23,6 +24,7 @@ const App = () => {
2324
| TezosSendResponse
2425
| TezosSignResponse
2526
| TezosGetAccountResponse
27+
| ErrorObject
2628
| string
2729
| string[]
2830
| null
@@ -122,6 +124,8 @@ const App = () => {
122124
await provider.signer.disconnect();
123125
setIsConnected(false);
124126
setResult(null);
127+
setBalance("");
128+
setContractAddress("[click Origination to get contract address]");
125129
} catch (error) {
126130
console.error("Error disconnecting from Tezos:", error);
127131
}
@@ -161,7 +165,7 @@ const App = () => {
161165
res = await provider.tezosSendOrigination(
162166
SAMPLES[SAMPLE_KINDS.SEND_ORGINATION],
163167
);
164-
for (let attempt = 0; attempt < 5; attempt++) {
168+
for (let attempt = 0; attempt < 10; attempt++) {
165169
const contractAddressList = await provider.getContractAddress(
166170
res.hash,
167171
);
@@ -220,7 +224,7 @@ const App = () => {
220224
setResult([error.name, error.message]);
221225
} else {
222226
console.error(`Error sending ${kind}:`, error);
223-
setResult(JSON.stringify(error, null, 2));
227+
setResult(error as ErrorObject);
224228
}
225229
}
226230
},
@@ -283,6 +287,10 @@ const App = () => {
283287
<b>Balance: </b>
284288
{balance}
285289
</p>
290+
<p>
291+
<b>Contract address: </b>
292+
{contractAddress}
293+
</p>
286294
<div className="layout-container">
287295
<div className="btn-container">
288296
<button onClick={disconnect} onMouseEnter={describeClear}>

0 commit comments

Comments
 (0)