diff --git a/src/components/Activity.tsx b/src/components/Activity.tsx
index 438c08c..42941bf 100644
--- a/src/components/Activity.tsx
+++ b/src/components/Activity.tsx
@@ -46,11 +46,14 @@ const SubtleText: ParentComponent = (props) => {
return
{props.children}
}
-function OnChainItem(props: { item: OnChainTx }) {
+function OnChainItem(props: { item: OnChainTx, labels: string[] }) {
+ const [store, actions] = useMegaStore();
const isReceive = createMemo(() => props.item.received > 0);
const [open, setOpen] = createSignal(false)
+
+
return (
<>
@@ -58,9 +61,10 @@ function OnChainItem(props: { item: OnChainTx }) {
Mempool Link
+ {JSON.stringify(props.labels)}
props.item.is_send);
const [open, setOpen] = createSignal(false)
+ const labels = createMemo(() => {
+ const labels = store.mutiny_wallet?.get_address_labels();
+ console.log(labels);
+ if (!labels) return ["abcdefg"];
+ return labels;
+ // return labels.filter((label) => label.address === props.item.txid)
+ })
+
return (
<>
@@ -145,92 +158,6 @@ function Utxo(props: { item: UtxoItem }) {
)
}
-export function Activity() {
- const [state, _] = useMegaStore();
-
- const getTransactions = async () => {
- console.log("Getting onchain txs");
- const txs = await state.mutiny_wallet?.list_onchain() as OnChainTx[];
- return txs.reverse();
- }
-
- const getInvoices = async () => {
- console.log("Getting invoices");
- const invoices = await state.mutiny_wallet?.list_invoices() as MutinyInvoice[];
- return invoices.filter((inv) => inv.paid).reverse();
- }
-
- const getUtXos = async () => {
- console.log("Getting utxos");
- const utxos = await state.mutiny_wallet?.list_utxos() as UtxoItem[];
- return utxos;
- }
-
- const [transactions, { refetch: _refetchTransactions }] = createResource(getTransactions);
- const [invoices, { refetch: _refetchInvoices }] = createResource(getInvoices);
- const [utxos, { refetch: _refetchUtxos }] = createResource(getUtXos);
-
- return (
-
-
-
-
-
-
-
-
- No transactions (empty state)
-
- = 0}>
-
- {(tx) =>
-
- }
-
-
-
-
-
-
-
-
-
-
- No invoices (empty state)
-
- = 0}>
-
- {(invoice) =>
-
- }
-
-
-
-
-
-
-
-
-
-
- No utxos (empty state)
-
- = 0}>
-
- {(utxo) =>
-
- }
-
-
-
- Redshift
-
-
-
- )
-
-}
-
type ActivityItem = { type: "onchain" | "lightning", item: OnChainTx | MutinyInvoice, time: number }
function sortByTime(a: ActivityItem, b: ActivityItem) {
@@ -267,6 +194,21 @@ export function CombinedActivity(props: { limit?: number }) {
const [activity] = createResource(getAllActivity);
+ const addressLabels = createMemo(() => {
+ const labels = state.mutiny_wallet?.get_address_labels();
+ console.log(labels);
+ return labels || [];
+ // return labels.filter((label) => label.address === props.item.txid)
+ })
+
+ const invoiceLabels = createMemo(() => {
+ const labels = state.mutiny_wallet?.get_address_labels();
+ console.log(labels);
+ if (!labels) return ["abcdefg"];
+ return labels;
+ // return labels.filter((label) => label.address === props.item.txid)
+ })
+
return (
@@ -280,10 +222,12 @@ export function CombinedActivity(props: { limit?: number }) {
{(activityItem) =>
-
+ {/* FIXME */}
+
-
+ {/* FIXME */}
+
}
diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx
index 00031f5..130a710 100644
--- a/src/routes/Receive.tsx
+++ b/src/routes/Receive.tsx
@@ -51,6 +51,10 @@ type ReceiveFlavor = "unified" | "lightning" | "onchain"
type ReceiveState = "edit" | "show" | "paid"
type PaidState = "lightning_paid" | "onchain_paid";
+function tagItemsToLabels(items: TagItem[]) {
+ return items.map(item => item.kind === "contact" ? item.id : item.name)
+}
+
export default function Receive() {
const [state, _] = useMegaStore()
const navigate = useNavigate();
@@ -103,9 +107,11 @@ export default function Receive() {
async function getUnifiedQr(amount: string) {
const bigAmount = BigInt(amount);
+ console.log(selectedValues());
+ console.log(tagItemsToLabels(selectedValues()))
try {
// FIXME: actual labels
- const raw = await state.mutiny_wallet?.create_bip21(bigAmount, []);
+ const raw = await state.mutiny_wallet?.create_bip21(bigAmount, tagItemsToLabels(selectedValues()));
// Save the raw info so we can watch the address and invoice
setBip21Raw(raw);