-

-
+
+
+

+
- {props.redshifted &&
RS
}
- {!props.item.redshifted && Unknown
}
+ Unknown}>
+ Redshift
+
- {props.item?.is_spent ? "SPENT" : "UNSPENT"}
+ {/* {props.item?.is_spent ? "SPENT" : "UNSPENT"} */}
@@ -49,28 +176,14 @@ const FAKE_STATES = ["Creating a new node", "Opening a channel", "Sending funds
function ShiftObserver(props: { setShiftStage: (stage: ShiftStage) => void }, utxo: UtxoItem) {
const [fakeStage, setFakeStage] = createSignal(2);
- // onMount(() => {
- // const interval = setInterval(() => {
- // console.log("intervaling")
- // if (fakeStage() === FAKE_STATES.length - 1) {
- // clearInterval(interval)
- // props.setShiftStage("success");
- // } else {
- // setFakeStage((fakeStage() + 1))
- // }
- // // cont()
- // }, 1000)
- // // return () => clearInterval(interval);
- // })
-
const [sentAmount, setSentAmount] = createSignal(0);
onMount(() => {
const interval = setInterval(() => {
if (sentAmount() === 200000) {
- // clearInterval(interval)
- // props.setShiftStage("success");
- setSentAmount((0))
+ clearInterval(interval)
+ props.setShiftStage("success");
+ // setSentAmount((0))
} else {
setSentAmount((sentAmount() + 50000))
@@ -92,22 +205,67 @@ function ShiftObserver(props: { setShiftStage: (stage: ShiftStage) => void }, ut
)
}
+const KV: ParentComponent<{ key: string }> = (props) => {
+ return (
+
+
{props.key}
+ {props.children}
+
+ )
+}
+
+const KVPre: ParentComponent<{ key: string }> = (props) => {
+ return (
+
+
{props.key}
+
+ {props.children}
+
+
+ )
+}
+
+function SingleChannel(props: { channel: MutinyChannel }) {
+ return (
+
+
+ {/* {JSON.stringify(props.channel, null, 2)} */}
+
+ {props.channel.peer}
+ {props.channel.outpoint}
+ {/* TODO: don't hardcode this */}
+
+ View on mempool
+
+
+ )
+}
+
export default function Redshift() {
const [state, _actions] = useMegaStore();
- const [shiftStage, setShiftStage] = createSignal
("observe");
+ const [shiftStage, setShiftStage] = createSignal("choose");
const [shiftType, setShiftType] = createSignal("utxo");
const [chosenUtxo, setChosenUtxo] = createSignal();
const getUtXos = async () => {
console.log("Getting utxos");
- const utxos = await state.node_manager?.list_utxos() as UtxoItem[];
- return utxos;
+ return await state.node_manager?.list_utxos() as UtxoItem[];
+ }
+
+ const getChannels = async () => {
+ console.log("Getting channels");
+ await state.node_manager?.sync()
+ const channels = await state.node_manager?.list_channels() as Promise;
+ console.log(channels)
+ return channels
+
}
const [utxos, { refetch: _refetchUtxos }] = createResource(getUtXos);
+ const [channels, { refetch: _refetchChannels }] = createResource(getChannels);
createEffect(() => {
if (chosenUtxo()) {
@@ -167,7 +325,7 @@ export default function Redshift() {
= 0}>
{(utxo) =>
-
+
}
@@ -180,11 +338,8 @@ export default function Redshift() {
-
- We did it. Here's your new UTXO:
-
-
-
+
+