Skip to content

Commit 867f656

Browse files
author
Lena Hierzi
committed
feature: add alert when wallet is not connected
1 parent 735f7f3 commit 867f656

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

example-frontend/pages/autoOffsetExactInETH.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export default function AutoOffsetExactInETH() {
2222
);
2323
// retire carbon credits using native tokens e.g., MATIC, specifying the exact amount of TCO2s to retire (only on Polygon, not on Celo),
2424
const offset = async () => {
25+
if (!signer) {
26+
alert("Please Connect your Wallet.");
27+
}
28+
2529
try {
2630
const result = await offsetHelper.autoOffsetExactInETH(poolAddress, {
2731
value: amount,

example-frontend/pages/autoOffsetExactInToken.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export default function AutoOffsetExactInToken() {
3131
signer || provider
3232
);
3333
const offset = async () => {
34+
if (!signer) {
35+
alert("Please Connect your Wallet.");
36+
}
37+
3438
try {
3539
// approve spending of deposited tokens
3640
await (

example-frontend/pages/autoOffsetExactOutETH.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export default function AutoOffsetExactOutETH() {
2121
signer || provider
2222
);
2323
const offset = async () => {
24+
if (!signer) {
25+
alert("Please Connect your Wallet.");
26+
}
27+
2428
try {
2529
// determine how much native tokens e.g., MATIC, token must be sent
2630
const amountOut = await offsetHelper.calculateNeededETHAmount(

example-frontend/pages/autoOffsetExactOutToken.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default function AutoOffsetExactOutToken() {
3434
signer || provider
3535
);
3636
const offset = async () => {
37+
if (!signer) {
38+
alert("Please Connect your Wallet.");
39+
}
40+
3741
try {
3842
// determine how much of the ERC20 token must be sent
3943
const amountOut = await offsetHelper.calculateNeededTokenAmount(

example-frontend/pages/autoOffsetPoolToken.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export default function AutoOffsetPoolToken() {
2929
);
3030

3131
const offset = async () => {
32+
if (!signer) {
33+
alert("Please Connect your Wallet.");
34+
}
35+
3236
try {
3337
// approve spending of pool tokens
3438
await (await poolToken.approve(offsetHelper.address, amount)).wait();

0 commit comments

Comments
 (0)