Skip to content

Commit

Permalink
fix: if faucet fails, should still return wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Jul 25, 2024
1 parent d80d07a commit 2e68e79
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions data/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ export function useWallet() {
if (existingWallets.length === 0) {
const newWallet = AElf.wallet.createNewWallet();
await db.wallet.add({ privateKey: newWallet.privateKey });
await(
await fetch(
`https://faucet.aelf.dev/api/claim?walletAddress=${newWallet.address}`,
{ method: "POST" }
)
).json();
try {
await(
await fetch(
`https://faucet.aelf.dev/api/claim?walletAddress=${newWallet.address}`,
{ method: "POST" }
)
).json();
} catch (err) {}
return newWallet.privateKey as string;
} else {
return existingWallets[0].privateKey;
Expand Down

0 comments on commit 2e68e79

Please sign in to comment.