Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Checkout from './components/pages/Register/Checkout';
import ArNSSettings from './components/pages/Settings/ArNSSettings';
import NetworkSettings from './components/pages/Settings/NetworkSettings';
import SettingsOverview from './components/pages/Settings/SettingsOverview';
import useSyncSettings from './hooks/useSyncSettings/useSyncSettings';
import useWanderEvents from './hooks/useWanderEvents/useWanderEvents';
import './index.css';
import { useGlobalState } from './state';
Expand Down Expand Up @@ -71,6 +72,7 @@ const sentryCreateBrowserRouter =

function App() {
useWanderEvents();
useSyncSettings();
const [{ turboNetwork }] = useGlobalState();

const stripePromise = useMemo(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/data-display/tables/DomainsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const DomainsTable = ({
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const [{ walletAddress }] = useWalletState();
const [{ arioProcessId, aoNetwork }] = useGlobalState();
const [{ arioProcessId, aoNetwork, hyperbeamUrl }] = useGlobalState();
const [{ loading: loadingArnsState }, dispatchArNSState] = useArNSState();
const { data: antVersion } = useLatestANTVersion();
const antModuleId = antVersion?.moduleId ?? null;
Expand Down Expand Up @@ -362,6 +362,7 @@ const DomainsTable = ({
aoNetwork,
queryClient,
walletAddress,
hyperbeamUrl,
dispatch: dispatchArNSState,
});
}}
Expand Down
87 changes: 86 additions & 1 deletion src/components/devtools/NetworkSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ const Panel = Collapse.Panel;

function NetworkSettings() {
const [
{ gateway, aoNetwork, arioProcessId, arioContract, turboNetwork },
{
gateway,
aoNetwork,
arioProcessId,
arioContract,
turboNetwork,
hyperbeamUrl,
},
dispatchGlobalState,
] = useGlobalState();
const [{ wallet }] = useWalletState();
Expand Down Expand Up @@ -57,6 +64,11 @@ function NetworkSettings() {
const [validTurboPaymentUrl, setValidTurboPaymentUrl] =
useState<boolean>(true);

const [newHyperbeamUrl, setNewHyperbeamUrl] = useState<string>(
hyperbeamUrl || '',
);
const [validHyperbeamUrl, setValidHyperbeamUrl] = useState<boolean>(true);

function reset() {
// gateway
setNewGateway(NETWORK_DEFAULTS.ARWEAVE.HOST);
Expand All @@ -78,6 +90,13 @@ function NetworkSettings() {
setNewTurboPaymentUrl(NETWORK_DEFAULTS.TURBO.PAYMENT_URL);
setValidTurboPaymentUrl(true);
updateTurboNetwork(NETWORK_DEFAULTS.TURBO);
// hyperbeam network
setNewHyperbeamUrl(NETWORK_DEFAULTS.AO.ARIO.HYPERBEAM_URL || '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting seems off

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope thats how prettier wants it.

setValidHyperbeamUrl(true);
dispatchGlobalState({
type: 'setHyperbeamUrl',
payload: NETWORK_DEFAULTS.AO.ARIO.HYPERBEAM_URL || undefined,
});
}

useEffect(() => {
Expand All @@ -94,6 +113,11 @@ function NetworkSettings() {
setValidSuAddress(true);
}, [aoNetwork.ARIO]);

useEffect(() => {
setNewHyperbeamUrl(hyperbeamUrl || '');
setValidHyperbeamUrl(true);
}, [hyperbeamUrl]);

async function updateGateway(gate: string) {
try {
if (!isValidGateway(gate)) {
Expand Down Expand Up @@ -567,6 +591,67 @@ function NetworkSettings() {
</div>
}
/>
<span className="flex w-fit whitespace-nowrap items-center bg-primary-thin rounded-t-md px-4 py-1 border-x-2 border-t-2 border-primary text-md text-primary font-semibold mt-2 gap-4 justify-center">
Hyperbeam URL:{' '}
<span className="text-white pl-2 flex">
{hyperbeamUrl || ''}
</span>
{!hyperbeamUrl && (
<span className="text-red-500 font-bold">DISABLED</span>
)}
</span>

<Input
className="bg-background justify-center items-center"
placeholder="https://hyperbeam.ario.permaweb.services"
value={newHyperbeamUrl}
onChange={(e) => {
setValidHyperbeamUrl(isValidURL(e.target.value.trim()));
setNewHyperbeamUrl(e.target.value.trim());
}}
onClear={() => setNewHyperbeamUrl('')}
onPressEnter={(e) =>
dispatchGlobalState({
type: 'setHyperbeamUrl',
payload: e.currentTarget.value.trim(),
})
}
variant="outlined"
status={validHyperbeamUrl ? '' : 'error'}
addonAfter={
<div className="flex flex-row" style={{ gap: '5px' }}>
<button
disabled={!validHyperbeamUrl}
className="bg-primary text-black h-full flex w-fit p-1 rounded-sm text-xs"
onClick={() =>
dispatchGlobalState({
type: 'setHyperbeamUrl',
payload: newHyperbeamUrl.trim(),
})
}
>
Set Hyperbeam URL
</button>
<button
className="bg-primary-thin text-white h-full flex w-fit p-1 rounded-sm text-xs"
onClick={() => {
setNewHyperbeamUrl(
NETWORK_DEFAULTS.AO.ARIO.HYPERBEAM_URL || '',
);
setValidHyperbeamUrl(true);
dispatchGlobalState({
type: 'setHyperbeamUrl',
payload:
NETWORK_DEFAULTS.AO.ARIO.HYPERBEAM_URL || undefined,
});
}}
>
reset
</button>
</div>
}
/>

<div className="flex flex-row p-2 justify-end items-center">
<button
className="p-2 text-white border-2 border-black hover:bg-primary hover:text-black bg-primary-thin rounded-md font-bold"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@ function NameTokenSelector({
}

const fetchedprocessIds: Array<ArweaveTransactionID> = [];
// const fetchedprocessIds = await arweaveDataProvider
// .getContractsForWallet({
// address,
// })
// .catch(() => {
// throw new Error('Unable to get contracts for wallet');
// });

const validImports = imports.length
? await Promise.all(
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type NavItem = {
export const ANT_FLAG = 'ant-flag';

function Breadcrumbs() {
const [{ aoNetwork }] = useGlobalState();
const [{ aoNetwork, hyperbeamUrl }] = useGlobalState();
const queryClient = useQueryClient();
const location = useLocation();
const path = location.pathname.split('/');
Expand Down Expand Up @@ -63,6 +63,7 @@ function Breadcrumbs() {
buildDomainInfoQuery({
antId: processId,
aoNetwork,
hyperbeamUrl,
}),
);
const name = domainInfo?.name;
Expand Down
3 changes: 3 additions & 0 deletions src/components/modals/PrimaryNameModal/PrimaryNameModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ function PrimaryNameModal({
processId: arioProcessId,
fundFrom: fundingSource,
dispatch: dispatchTransactionState,

hyperbeamUrl,
});

break;
Expand Down Expand Up @@ -239,6 +241,7 @@ function PrimaryNameModal({
aoNetwork: aoNetwork,
walletAddress,
queryClient,
hyperbeamUrl,
});

closeModal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export function ReassignNameModal({
arioProcessId,
dispatch: dispatchArNSState,
aoNetworkSettings: aoNetwork,
hyperbeamUrl,
});
handleClose();
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function ReturnNameModal({
arioProcessId,
dispatch: dispatchArNSState,
aoNetworkSettings: aoNetwork,
hyperbeamUrl,
});
setShow(false);
navigate('/manage');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ function UpgradeDomainModal({
domain: string;
}) {
const queryClient = useQueryClient();
const [{ antAoClient, aoNetwork, arioContract, arioProcessId }] =
useGlobalState();
const [
{ antAoClient, aoNetwork, arioContract, arioProcessId, hyperbeamUrl },
] = useGlobalState();
const [, dispatchArNSState] = useArNSState();
const [{ wallet, walletAddress }] = useWalletState();
const [, dispatchTransactionState] = useTransactionState();
Expand Down Expand Up @@ -74,6 +75,7 @@ function UpgradeDomainModal({
arioContract,
arioProcessId,
aoNetwork,
hyperbeamUrl,
wallet,
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ function UpgradeDomainsModal({
visible: boolean;
setVisible: (visible: boolean) => void;
}) {
const [{ antAoClient, aoNetwork, arioProcessId, arioContract }] =
useGlobalState();
const [
{ antAoClient, aoNetwork, arioProcessId, arioContract, hyperbeamUrl },
] = useGlobalState();
const [{ wallet, walletAddress }] = useWalletState();
const [accepted, setAccepted] = useState(false);
const [domainsToUpgrade, setDomainsToUpgrade] = useState<string[]>([]);
Expand Down Expand Up @@ -104,6 +105,7 @@ function UpgradeDomainsModal({
arioContract,
arioProcessId,
aoNetwork,
hyperbeamUrl,
wallet,
}),
);
Expand Down Expand Up @@ -185,6 +187,7 @@ function UpgradeDomainsModal({
walletAddress: walletAddress!,
arioProcessId: arioProcessId,
aoNetworkSettings: aoNetwork,
hyperbeamUrl,
});
handleClose();
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/Manage/Manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { RefreshIcon, SearchIcon } from '../../icons';
import './styles.css';

function Manage() {
const [{ arioProcessId, aoNetwork }] = useGlobalState();
const [{ arioProcessId, aoNetwork, hyperbeamUrl }] = useGlobalState();
const [{ loading: loadingArnsState, domains, ants }, dispatchArNSState] =
useArNSState();
const { data: antVersion } = useLatestANTVersion();
Expand Down Expand Up @@ -100,6 +100,7 @@ function Manage() {
walletAddress: walletAddress,
arioProcessId,
aoNetworkSettings: aoNetwork,
hyperbeamUrl,
})
: eventEmitter.emit('error', {
name: 'Manage Assets',
Expand Down
15 changes: 13 additions & 2 deletions src/components/pages/Register/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ import { useNavigate } from 'react-router-dom';
// on completion routes to transaction/complete
function Checkout() {
const navigate = useNavigate();
const [{ arioContract, arioProcessId, aoNetwork, aoClient, arioTicker }] =
useGlobalState();
const [
{
arioContract,
arioProcessId,
aoNetwork,
aoClient,
arioTicker,
hyperbeamUrl,
},
] = useGlobalState();
const turbo = useTurboArNSClient();
const [, dispatchArNSState] = useArNSState();
const [{ walletAddress, wallet }] = useWalletState();
Expand Down Expand Up @@ -323,6 +331,8 @@ function Checkout() {
? 'turbo'
: fundingSource,
turboArNSClient: turbo,

hyperbeamUrl,
});
} catch (error) {
eventEmitter.emit('error', error);
Expand All @@ -333,6 +343,7 @@ function Checkout() {
arioProcessId,
walletAddress,
aoNetworkSettings: aoNetwork,
hyperbeamUrl,
});
}
}
Expand Down
Loading