Skip to content

Commit

Permalink
Fix Friendbot (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits authored Dec 12, 2023
1 parent 106d4ff commit f82bb03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/actions/accountCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export function updateFriendbotTarget(target) {

export const START_FRIENDBOT_REQUEST = "START_FRIENDBOT_REQUEST";
export const FINISH_FRIENDBOT_REQUEST = "FINISH_FRIENDBOT_REQUEST";
export function startFriendbotRequest(target, isSoroban = false) {
const friendbotURL = isSoroban
export function startFriendbotRequest(target, isFuturenet = false) {
const friendbotURL = isFuturenet
? "https://friendbot-futurenet.stellar.org"
: "https://friendbot.stellar.org";
return (dispatch) => {
Expand Down
13 changes: 7 additions & 6 deletions src/views/FriendbotFundAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import { CodeBlock } from "components/CodeBlock";
import PubKeyPicker from "components/FormComponents/PubKeyPicker";
import NETWORK from "constants/network.js";
import { useRedux } from "hooks/useRedux";
import { useIsSoroban } from "hooks/useIsSoroban";
import { ActionStatus } from "types/types";

export const FriendbotFundAccount = () => {
const { accountCreator, network } = useRedux("accountCreator", "network");
const { friendbotStatus, friendbotTarget } = accountCreator;
const baseURL = network.current.horizonURL;
const IS_TESTNET = baseURL === NETWORK.available.test.horizonURL;
const isSoroban = useIsSoroban();
const IS_FUTURENET = baseURL === NETWORK.available.futurenet.horizonURL;

const dispatch = useDispatch();

Expand Down Expand Up @@ -60,19 +59,21 @@ export const FriendbotFundAccount = () => {
return null;
};

if (IS_TESTNET || isSoroban) {
if (IS_TESTNET || IS_FUTURENET) {
return (
<div
className="so-back AccountCreator__section"
data-testid="page-friendbot"
>
<div className="so-chunk">
<h3>
Friendbot: Fund a {isSoroban ? "Soroban" : "test"} network account
Friendbot: Fund a {IS_FUTURENET ? "futurenet" : "test"} network
account
</h3>
<p>
The friendbot is a horizon API endpoint that will fund an account
with 10,000 lumens on the {isSoroban ? "Soroban " : "test"} network.
with 10,000 lumens on the {IS_FUTURENET ? "futurenet " : "test"}{" "}
network.
</p>

<PubKeyPicker
Expand All @@ -88,7 +89,7 @@ export const FriendbotFundAccount = () => {
className="s-button"
disabled={friendbotTarget.length === 0}
onClick={() =>
dispatch(startFriendbotRequest(friendbotTarget, isSoroban))
dispatch(startFriendbotRequest(friendbotTarget, IS_FUTURENET))
}
>
Get test network lumens
Expand Down

0 comments on commit f82bb03

Please sign in to comment.