update to 0.5.0-rc1

This commit is contained in:
Paul Miller
2023-12-21 12:53:37 -06:00
parent dc18a38d22
commit 4b785b4eef
7 changed files with 15 additions and 51 deletions

View File

@@ -39,19 +39,10 @@ function PeerItem(props: { peer: MutinyPeer }) {
const [state, _] = useMegaStore();
const handleDisconnectPeer = async () => {
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
if (props.peer.is_connected) {
await state.mutiny_wallet?.disconnect_peer(
firstNode,
props.peer.pubkey
);
await state.mutiny_wallet?.disconnect_peer(props.peer.pubkey);
} else {
await state.mutiny_wallet?.delete_peer(
firstNode,
props.peer.pubkey
);
await state.mutiny_wallet?.delete_peer(props.peer.pubkey);
}
};
@@ -132,13 +123,8 @@ function ConnectPeer(props: { refetchPeers: RefetchPeersType }) {
e.preventDefault();
const peerConnectString = value().trim();
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
await state.mutiny_wallet?.connect_to_peer(
firstNode,
peerConnectString
);
await state.mutiny_wallet?.connect_to_peer(peerConnectString);
await props.refetchPeers();
@@ -353,11 +339,7 @@ function OpenChannel(props: { refetchChannels: RefetchChannelsListType }) {
const pubkey = peerPubkey().trim();
const bigAmount = BigInt(amount());
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
const new_channel = await state.mutiny_wallet?.open_channel(
firstNode,
pubkey,
bigAmount
);

View File

@@ -75,8 +75,7 @@ export function PendingNwc() {
async function payItem(item: PendingItem) {
try {
setPaying(item.id);
const nodes = await state.mutiny_wallet?.list_nodes();
await state.mutiny_wallet?.approve_invoice(item.id, nodes[0]);
await state.mutiny_wallet?.approve_invoice(item.id);
await vibrateSuccess();
} catch (e) {
setError(eify(e));

View File

@@ -258,6 +258,10 @@ export async function setupMutinyWallet(
esplora,
rgs,
lsp,
// LSPS connection string
undefined,
// LSPS token
undefined,
auth,
subscriptions,
storage,

View File

@@ -573,13 +573,10 @@ export function Send() {
const tags = await processContacts(selectedContacts());
if (source() === "lightning" && invoice() && bolt11) {
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
sentDetails.destination = bolt11;
// If the invoice has sats use that, otherwise we pass the user-defined amount
if (invoice()?.amount_sats) {
const payment = await state.mutiny_wallet?.pay_invoice(
firstNode,
bolt11,
undefined,
tags
@@ -589,7 +586,6 @@ export function Send() {
sentDetails.fee_estimate = payment?.fees_paid || 0;
} else {
const payment = await state.mutiny_wallet?.pay_invoice(
firstNode,
bolt11,
amountSats(),
tags
@@ -599,10 +595,7 @@ export function Send() {
sentDetails.fee_estimate = payment?.fees_paid || 0;
}
} else if (source() === "lightning" && nodePubkey()) {
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
const payment = await state.mutiny_wallet?.keysend(
firstNode,
nodePubkey()!,
amountSats(),
undefined, // todo add optional keysend message
@@ -618,10 +611,7 @@ export function Send() {
sentDetails.fee_estimate = payment?.fees_paid || 0;
}
} else if (source() === "lightning" && lnurlp()) {
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
const payment = await state.mutiny_wallet?.lnurl_pay(
firstNode,
lnurlp()!,
amountSats(),
undefined, // zap_npub

View File

@@ -116,13 +116,8 @@ export function Swap() {
setIsConnecting(true);
try {
const peerConnectString = values.peer.trim();
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
await state.mutiny_wallet?.connect_to_peer(
firstNode,
peerConnectString
);
await state.mutiny_wallet?.connect_to_peer(peerConnectString);
await refetch();
@@ -156,8 +151,6 @@ export function Swap() {
if (canSwap()) {
try {
setLoading(true);
const nodes = await state.mutiny_wallet?.list_nodes();
const firstNode = (nodes[0] as string) || "";
let peer = undefined;
@@ -167,15 +160,11 @@ export function Swap() {
if (isMax()) {
const new_channel =
await state.mutiny_wallet?.sweep_all_to_channel(
firstNode,
peer
);
await state.mutiny_wallet?.sweep_all_to_channel(peer);
setChannelOpenResult({ channel: new_channel });
} else {
const new_channel = await state.mutiny_wallet?.open_channel(
firstNode,
peer,
amountSats()
);