Skip to content

Commit

Permalink
Cleanup isSoroban
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Dec 11, 2023
1 parent 9d4169f commit c6f3bdf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
7 changes: 1 addition & 6 deletions src/actions/xdrViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ export function fetchLatestTx(horizonBaseUrl, networkPassphrase) {
};
}

export function fetchSigners(
input,
horizonBaseUrl,
networkPassphrase,
isSoroban = false,
) {
export function fetchSigners(input, horizonBaseUrl, networkPassphrase) {
return (dispatch) => {
dispatch({ type: FETCHED_SIGNERS.PENDING });
try {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/extrapolateFromXdr.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import functionsIn from "lodash/functionsIn";
import includes from "lodash/includes";
import without from "lodash/without";

export default function extrapolateFromXdr(input, type, isSoroban = false) {
export default function extrapolateFromXdr(input, type) {
// TODO: Check to see if type exists
// TODO: input validation

Expand Down
7 changes: 2 additions & 5 deletions src/views/TransactionSubmitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import extrapolateFromXdr from "helpers/extrapolateFromXdr.js";
import { validateBase64 } from "helpers/validateBase64";
import { addEventHandler, logEvent } from "helpers/metrics.js";
import { useRedux } from "hooks/useRedux";
import { useIsSoroban } from "hooks/useIsSoroban";
import xdrViewerMetrics, { metricsEvents } from "metricsHandlers/xdrViewer.js";
import { TreeView } from "components/TreeView";
import { TxSubmitterResult } from "components/TxSubmitterResult";
Expand All @@ -24,7 +23,6 @@ export const TransactionSubmitter = () => {
const { xdrViewer, network } = useRedux("xdrViewer", "network");
const { fetchedSigners, input } = xdrViewer;
const { horizonURL, networkPassphrase } = network.current;
const isSoroban = useIsSoroban();
const { error, nodes } = useMemo(() => {
if (input === "") {
return {
Expand All @@ -43,7 +41,7 @@ export const TransactionSubmitter = () => {
try {
return {
error: null,
nodes: extrapolateFromXdr(input, "TransactionEnvelope", isSoroban),
nodes: extrapolateFromXdr(input, "TransactionEnvelope"),
};
} catch (e) {
console.error(e);
Expand All @@ -58,7 +56,7 @@ export const TransactionSubmitter = () => {

// Fetch signers on initial load
if (fetchedSigners.state === FETCHED_SIGNERS.NONE) {
dispatch(fetchSigners(input, horizonURL, networkPassphrase, isSoroban));
dispatch(fetchSigners(input, horizonURL, networkPassphrase));
}

return (
Expand All @@ -80,7 +78,6 @@ export const TransactionSubmitter = () => {
event.target.value,
horizonURL,
networkPassphrase,
isSoroban,
),
);
}}
Expand Down
9 changes: 2 additions & 7 deletions src/views/XdrViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { SelectPicker } from "components/FormComponents/SelectPicker";
import extrapolateFromXdr from "helpers/extrapolateFromXdr.js";
import { TreeView } from "components/TreeView";
import { useRedux } from "hooks/useRedux";
import { useIsSoroban } from "hooks/useIsSoroban";
import { validateBase64 } from "helpers/validateBase64";
import {
updateXdrInput,
Expand All @@ -31,7 +30,6 @@ export const XdrViewer = () => {
const { xdrViewer, network } = useRedux("xdrViewer", "network");
const { fetchedSigners, input, type } = xdrViewer;
const { horizonURL, networkPassphrase } = network.current;
const isSoroban = useIsSoroban();
// Array of all the xdr types. Then, the most common ones appear at the top
// again for convenience
let xdrTypes = functions(StellarSdk.xdr).sort();
Expand Down Expand Up @@ -60,9 +58,7 @@ export const XdrViewer = () => {
try {
treeView = (
<TreeView
nodes={
extrapolateFromXdr(input, type, isSoroban) as TransactionNode[]
}
nodes={extrapolateFromXdr(input, type) as TransactionNode[]}
fetchedSigners={fetchedSigners}
/>
);
Expand All @@ -80,7 +76,7 @@ export const XdrViewer = () => {
type === "TransactionEnvelope" &&
fetchedSigners.state === FETCHED_SIGNERS.NONE
) {
dispatch(fetchSigners(input, horizonURL, networkPassphrase, isSoroban));
dispatch(fetchSigners(input, horizonURL, networkPassphrase));
}

return (
Expand Down Expand Up @@ -124,7 +120,6 @@ export const XdrViewer = () => {
event.target.value,
horizonURL,
networkPassphrase,
isSoroban,
),
);
}
Expand Down

0 comments on commit c6f3bdf

Please sign in to comment.