diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d89a88..82faa6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,9 +10,6 @@ dependencies: '@modular-forms/solid': specifier: ^0.12.0 version: 0.12.0(solid-js@1.7.3) - '@motionone/solid': - specifier: ^10.16.0 - version: 10.16.0(solid-js@1.7.3) '@mutinywallet/mutiny-wasm': specifier: ^0.2.7 version: 0.2.7 @@ -1586,66 +1583,6 @@ packages: solid-js: 1.7.3 dev: false - /@motionone/animation@10.15.1: - resolution: {integrity: sha512-mZcJxLjHor+bhcPuIFErMDNyrdb2vJur8lSfMCsuCB4UyV8ILZLvK+t+pg56erv8ud9xQGK/1OGPt10agPrCyQ==} - dependencies: - '@motionone/easing': 10.15.1 - '@motionone/types': 10.15.1 - '@motionone/utils': 10.15.1 - tslib: 2.5.0 - dev: false - - /@motionone/dom@10.15.5: - resolution: {integrity: sha512-Xc5avlgyh3xukU9tydh9+8mB8+2zAq+WlLsC3eEIp7Ax7DnXgY7Bj/iv0a4X2R9z9ZFZiaXK3BO0xMYHKbAAdA==} - dependencies: - '@motionone/animation': 10.15.1 - '@motionone/generators': 10.15.1 - '@motionone/types': 10.15.1 - '@motionone/utils': 10.15.1 - hey-listen: 1.0.8 - tslib: 2.5.0 - dev: false - - /@motionone/easing@10.15.1: - resolution: {integrity: sha512-6hIHBSV+ZVehf9dcKZLT7p5PEKHGhDwky2k8RKkmOvUoYP3S+dXsKupyZpqx5apjd9f+php4vXk4LuS+ADsrWw==} - dependencies: - '@motionone/utils': 10.15.1 - tslib: 2.5.0 - dev: false - - /@motionone/generators@10.15.1: - resolution: {integrity: sha512-67HLsvHJbw6cIbLA/o+gsm7h+6D4Sn7AUrB/GPxvujse1cGZ38F5H7DzoH7PhX+sjvtDnt2IhFYF2Zp1QTMKWQ==} - dependencies: - '@motionone/types': 10.15.1 - '@motionone/utils': 10.15.1 - tslib: 2.5.0 - dev: false - - /@motionone/solid@10.16.0(solid-js@1.7.3): - resolution: {integrity: sha512-pxE5qQEtwv42bAllHFVapZevX5T4YTYzFe7vo0+Lljqyx+7+jP1NT0fosBUAOhDNdJNANNMldXwyh+qGBW5BrA==} - peerDependencies: - solid-js: ^1.5.0 - dependencies: - '@motionone/dom': 10.15.5 - '@motionone/utils': 10.15.1 - '@solid-primitives/props': 3.1.4(solid-js@1.7.3) - '@solid-primitives/refs': 1.0.2(solid-js@1.7.3) - '@solid-primitives/transition-group': 1.0.2(solid-js@1.7.3) - solid-js: 1.7.3 - dev: false - - /@motionone/types@10.15.1: - resolution: {integrity: sha512-iIUd/EgUsRZGrvW0jqdst8st7zKTzS9EsKkP+6c6n4MPZoQHwiHuVtTQLD6Kp0bsBLhNzKIBlHXponn/SDT4hA==} - dev: false - - /@motionone/utils@10.15.1: - resolution: {integrity: sha512-p0YncgU+iklvYr/Dq4NobTRdAPv9PveRDUXabPEeOjBLSO/1FNB2phNTZxOxpi1/GZwYpAoECEa0Wam+nsmhSw==} - dependencies: - '@motionone/types': 10.15.1 - hey-listen: 1.0.8 - tslib: 2.5.0 - dev: false - /@mutinywallet/mutiny-wasm@0.2.7: resolution: {integrity: sha512-AssJjkqDdYLD9kzJWfMJe1lZL+uGDBJbmd5ehUokdLKGbIrSpUzBO8hWDjWxI8dteci4laApZ/WfVRjVW7PQ9Q==} dev: false @@ -1906,14 +1843,6 @@ packages: solid-js: 1.7.3 dev: false - /@solid-primitives/transition-group@1.0.2(solid-js@1.7.3): - resolution: {integrity: sha512-+o3J7TnU0/Sok+LKA0z0wvhim88dpd2eFBk8/05adE6wVypVlME8sKqTMO+xRv8HoT4Kq3sczmvwV07FKg2n+g==} - peerDependencies: - solid-js: ^1.6.12 - dependencies: - solid-js: 1.7.3 - dev: false - /@solid-primitives/utils@5.5.2(solid-js@1.7.3): resolution: {integrity: sha512-L52ig3eHKU6CqbPCKJIb4lweBuINHBOERcE1duApyKozEN8+zCqEKwD1Qo9ljKeEzJTBGWClxNpwEiNTUWTGvg==} peerDependencies: @@ -3575,10 +3504,6 @@ packages: dependencies: function-bind: 1.1.1 - /hey-listen@1.0.8: - resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==} - dev: false - /html-entities@2.3.3: resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} diff --git a/src/routes/Scanner.tsx b/src/routes/Scanner.tsx index 0e39964..85d755b 100644 --- a/src/routes/Scanner.tsx +++ b/src/routes/Scanner.tsx @@ -13,6 +13,7 @@ export type ParsedParams = { amount_sats?: bigint; network?: string; memo?: string; + node_pubkey?: string; } export function toParsedParams(str: string, ourNetwork: string): Result { @@ -24,16 +25,23 @@ export function toParsedParams(str: string, ourNetwork: string): Result(); + const [nodePubkey, setNodePubkey] = createSignal(); const [address, setAddress] = createSignal(); const [description, setDescription] = createSignal(); @@ -78,7 +79,11 @@ export default function Send() { if (source.address) setAddress(source.address) if (source.memo) setDescription(source.memo); - if (source.invoice) { + if (source.node_pubkey) { + setAmountSats(source.amount_sats || 0n); + setNodePubkey(source.node_pubkey); + setSource("lightning") + } else if (source.invoice) { state.node_manager?.decode_invoice(source.invoice).then(invoice => { if (invoice?.amount_sats) setAmountSats(invoice.amount_sats); setInvoice(invoice) @@ -104,7 +109,7 @@ export default function Send() { showToast(result.error); return; } else { - if (result.value?.address || result.value?.invoice) { + if (result.value?.address || result.value?.invoice || result.value?.node_pubkey) { setDestination(result.value); // Important! we need to clear the scan result once we've used it actions.setScanResult(undefined); @@ -146,6 +151,12 @@ export default function Send() { await state.node_manager?.pay_invoice(firstNode, bolt11, amountSats()); sentDetails.amount = amountSats(); } + } else if (source() === "lightning" && nodePubkey()) { + const nodes = await state.node_manager?.list_nodes(); + const firstNode = nodes[0] as string || "" + const invoice = await state.node_manager?.keysend(firstNode, nodePubkey()!, amountSats()); + console.log(invoice?.value) + sentDetails.amount = amountSats(); } else { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const txid = await state.node_manager?.send_to_address(address()!, amountSats()); @@ -165,6 +176,10 @@ export default function Send() { } } + const sendButtonDisabled = createMemo(() => { + return !destination() || sending() || amountSats() === 0n; + }) + return ( @@ -188,7 +203,7 @@ export default function Send() {
- +
{"Address: "} {address()} @@ -206,6 +221,11 @@ export default function Send() { + + {"Node Pubkey: "} {nodePubkey()} + + +
@@ -263,7 +283,7 @@ export default function Send() { - +