Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@emoji-mart/react": "1.1.1",
"@emotion/react": "11.10.0",
"@emotion/styled": "11.10.0",
"@getalby/bitcoin-connect-react": "2.4.2",
"@joyid/nostr": "0.1.0",
"@noble/hashes": "1.1.5",
"@noble/secp256k1": "1.7.0",
Expand Down
19 changes: 19 additions & 0 deletions src/components/BitcoinConnect/BitcoinButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Button } from '@getalby/bitcoin-connect-react';

interface BitcoinButtonProps {}

const BitcoinButton: React.FC<BitcoinButtonProps> = () => {
const handleConnect = () => {

};

return (
<div className="bitcoin-connect-container">
<Button onConnect={handleConnect} />
</div>
);
};

export default BitcoinButton;

18 changes: 17 additions & 1 deletion src/components/PostItems/PostReactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Tooltip, message } from 'antd';
import { useTranslation } from 'next-i18next';
import { fetchPublicBookmarkListEvent } from 'components/PostItems/PostReactions/util';
import { useReadonlyMyPublicKey } from 'hooks/useMyPublicKey';
import { useState } from 'react';
import { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import {
EventSetMetadataContent,
Expand All @@ -24,6 +24,8 @@ import { dexieDb } from 'core/db';
import Icon from 'components/Icon';
import styles from './index.module.scss';



interface PostReactionsProp {
ownerEvent: Event;
worker: CallWorker;
Expand All @@ -35,6 +37,14 @@ const PostReactions: React.FC<PostReactionsProp> = ({
worker,
seen,
}) => {



// load bitcoin connect for zaps
import('@getalby/bitcoin-connect-react');



const { t } = useTranslation();

const router = useRouter();
Expand All @@ -61,6 +71,8 @@ const PostReactions: React.FC<PostReactionsProp> = ({
};

const zap = async () => {


if (signEvent == null) return;

let zapEndpoint: any = null;
Expand Down Expand Up @@ -133,8 +145,12 @@ const PostReactions: React.FC<PostReactionsProp> = ({
const handler = worker.pubEvent(event);
noticePubEventResult(worker.relays.length, handler);
setIsBookMarking(false);


};



return (
<ul className={styles.reactions}>
{contextHolder}
Expand Down
1 change: 1 addition & 0 deletions src/pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { joyIdConfig } from 'core/joyid/config';
import Head from 'next/head';
import theme from 'constants/theme';


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To resolve - why could you not import bitcoin connect here? it's needed so zaps work on every page

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alan-AC7 For NextJS you can add this to src/components/PostItems/PostReactions/index.tsx to only import the library clientside:

useEffect(() => {
    // load bitcoin connect for zaps
    import("@getalby/bitcoin-connect-react");
  }, []);

type NextPageWithLayout = NextPage & {
getLayout?: (page: ReactNode) => ReactElement;
};
Expand Down
1 change: 1 addition & 0 deletions src/pages/setting/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
.about {
text-align: center;
}

15 changes: 14 additions & 1 deletion src/pages/setting/preference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { RelayGroup } from 'core/relay/group';
import { useReadonlyMyPublicKey } from 'hooks/useMyPublicKey';
import { useEffect, useState } from 'react';
import { exportDB } from 'dexie-export-import';
import BitcoinButton from 'components/BitcoinConnect/BitcoinButton';



export default function Preference() {
const myPublicKey = useReadonlyMyPublicKey();
Expand Down Expand Up @@ -98,7 +101,7 @@ export default function Preference() {
duration: 0,
});

// Function to close the loading message when called

const closeLoadingMessage = () => {
message.destroy(key);
};
Expand Down Expand Up @@ -159,6 +162,16 @@ export default function Preference() {
Zap Amount
</List.Item>


<List.Item
actions={[

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
key={'btc-connect'}

this should fixed the compiled error

<BitcoinButton key="btc-connect"/>,
]}
>
Bitcoin Connect
</List.Item>

<Divider orientation="left">Database</Divider>
<List.Item
actions={[
Expand Down
8 changes: 8 additions & 0 deletions src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,11 @@
text-overflow: ellipsis;
white-space: nowrap;
}


//bitcoin-connect
:root {
--bc-color-brand: var(--primary-07);
}


127 changes: 125 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,41 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.2.tgz#b7e9309ccce5a0a40ac482cb894f120dba2b357f"
integrity sha512-ou3elfqG/hZsbmF4bxeJhPHIf3G2pm0ujc39hYEZrfVqt7Vk/Zji6CXc3W0pmYM8BW1g40U+akTl9DKZhFhInQ==

"@getalby/bitcoin-connect-react@2.4.2":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-2.4.2.tgz#a564bd5b607b3efdc8ae9e73a3a6009ceda1af63"
integrity sha512-4J0NjfYByOKKPa3q4nQ0j87VB+qQ0xtLqqJBMiHDChQe//LhbEMxJcEA8gXrc4C2WX6PZSm1sbNkZghn0kphDA==
dependencies:
"@getalby/bitcoin-connect" "2.4.2"

"@getalby/bitcoin-connect@2.4.2":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-2.4.2.tgz#a7e9ff912b88bac46b0689167cc332794d5d9751"
integrity sha512-nBIXsODRj/K60dLHRl0LLKxojJoeeQAzH+SWmAC+wC9OkZwS168ziXdR4nvDOTSbNLA2ZIU+LLiWarTD6n+oeA==
dependencies:
"@getalby/lightning-tools" "^4.2.0"
"@getalby/sdk" "^2.7.0"
"@lightninglabs/lnc-web" "^0.2.6-alpha"
qrcode-generator "^1.4.4"
zustand "^4.4.1"

"@getalby/lightning-tools@^4.2.0":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@getalby/lightning-tools/-/lightning-tools-4.2.0.tgz#768025e7efb2e8c0271859ed7956615c83b73b76"
integrity sha512-o87OTIgKgzOjDPoepDATQVGc2WkrO0Mwt4w+QAorYJx1z5MaCTipJi2cTO0GESObH1sEWCorZikanhMoRUh+qA==
dependencies:
crypto-js "^4.1.1"
light-bolt11-decoder "^3.0.0"

"@getalby/sdk@^2.7.0":
version "2.7.0"
resolved "https://registry.yarnpkg.com/@getalby/sdk/-/sdk-2.7.0.tgz#20fdb5a39ffcbd9b9c9d7270bdacba97ac4d3f72"
integrity sha512-4NoEgdjx0R8SYDmJfCAsgvuBs0w3d8wsOMGI4m0h2MVsSeCcWW93lrzCl8bRmHTF5N7EfleHwnieYwn5j9KZTA==
dependencies:
crypto-js "^4.1.1"
events "^3.3.0"
nostr-tools "^1.17.0"

"@humanwhocodes/config-array@^0.11.8":
version "0.11.8"
resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"
Expand Down Expand Up @@ -1937,6 +1972,19 @@
resolved "https://registry.npmjs.org/@ledgerhq/connect-kit-loader/-/connect-kit-loader-1.0.2.tgz#8554e16943f86cc2a5f6348a14dfe6e5bd0c572a"
integrity sha512-TQ21IjcZOw/scqypaVFY3jHVqI7X7Hta3qN/us6FvTol3AY06UmrhhXGww0E9xHmAbdX241ddwXEiMBSQZFr9g==

"@lightninglabs/lnc-core@0.2.6-alpha":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-core/-/lnc-core-0.2.6-alpha.tgz#1b93d5aeefb09bb3dedcb82988368b15e223f8fd"
integrity sha512-bw2EQG78pPKMZMFwV+TR99RUbYgPVUKQYMLGGKIOvhPds3dBWSDZpMoqOyW/WidWGXF/ugPHzud8lDbKKhNXgA==

"@lightninglabs/lnc-web@^0.2.6-alpha":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-web/-/lnc-web-0.2.6-alpha.tgz#34f54f65691ff8cdef6eb159321b70c94f198f9e"
integrity sha512-SrqR8xaDnFLgNzPe5om7REOAhSOP95jQNIHP0GY0Lv895eDjrI6CPkfCFcX97INoDWYHBvDT8DZeYkBvlznVNA==
dependencies:
"@lightninglabs/lnc-core" "0.2.6-alpha"
crypto-js "4.1.1"

"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0":
version "1.1.1"
resolved "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9"
Expand Down Expand Up @@ -2127,13 +2175,25 @@
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz#ea6d23ade78a325f7a52750aab1526b02b628c29"
integrity sha512-3Yc1fUTs69MG/uZbJlLSI3JISMn2UV2rg+1D/vROUqZyh3l6iYHCs7GMp+M40ZD7yOdDbYjJcU1oTJhrc+dGKg==

"@noble/ciphers@0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.2.0.tgz#a12cda60f3cf1ab5d7c77068c3711d2366649ed7"
integrity sha512-6YBxJDAapHSdd3bLDv6x2wRPwq4QFMUaB3HvljNBUTThDd12eSm7/3F+2lnfzx2jvM+S6Nsy0jEt9QbPqSwqRw==

"@noble/curves@1.0.0", "@noble/curves@^1.0.0", "@noble/curves@~1.0.0":
version "1.0.0"
resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932"
integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw==
dependencies:
"@noble/hashes" "1.3.0"

"@noble/curves@1.1.0", "@noble/curves@~1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d"
integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==
dependencies:
"@noble/hashes" "1.3.1"

"@noble/hashes@1.1.5":
version "1.1.5"
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz#1a0377f3b9020efe2fae03290bd2a12140c95c11"
Expand All @@ -2144,6 +2204,16 @@
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1"
integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==

"@noble/hashes@1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9"
integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==

"@noble/hashes@~1.3.1":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39"
integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==

"@noble/secp256k1@1.7.0":
version "1.7.0"
resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz#d15357f7c227e751d90aa06b05a0e5cf993ba8c1"
Expand Down Expand Up @@ -2439,7 +2509,7 @@
dependencies:
cross-fetch "^3.1.5"

"@scure/base@~1.1.0":
"@scure/base@1.1.1", "@scure/base@~1.1.0":
version "1.1.1"
resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938"
integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==
Expand All @@ -2453,6 +2523,15 @@
"@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0"

"@scure/bip32@1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.1.tgz#7248aea723667f98160f593d621c47e208ccbb10"
integrity sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==
dependencies:
"@noble/curves" "~1.1.0"
"@noble/hashes" "~1.3.1"
"@scure/base" "~1.1.0"

"@scure/bip39@1.2.0":
version "1.2.0"
resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b"
Expand All @@ -2461,6 +2540,14 @@
"@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0"

"@scure/bip39@1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a"
integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==
dependencies:
"@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0"

"@sinclair/typebox@^0.25.16":
version "0.25.24"
resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718"
Expand Down Expand Up @@ -5328,7 +5415,7 @@ create-require@^1.1.0:

cross-env@7.0.3:
version "7.0.3"
resolved "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"
Expand Down Expand Up @@ -5378,6 +5465,11 @@ crypto-js@4.1.1:
resolved "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==

crypto-js@^4.1.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631"
integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==

crypto-random-string@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5"
Expand Down Expand Up @@ -8554,6 +8646,13 @@ liftoff@^2.5.0:
rechoir "^0.6.2"
resolve "^1.1.7"

light-bolt11-decoder@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/light-bolt11-decoder/-/light-bolt11-decoder-3.0.0.tgz#f644576120426c9ef65621bde254f11016055044"
integrity sha512-AKvOigD2pmC8ktnn2TIqdJu0K0qk6ukUmTvHwF3JNkm8uWCqt18Ijn33A/a7gaRZ4PghJ59X+8+MXrzLKdBTmQ==
dependencies:
"@scure/base" "1.1.1"

lilconfig@2.0.4:
version "2.0.4"
resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz#f4507d043d7058b380b6a8f5cb7bcd4b34cee082"
Expand Down Expand Up @@ -9554,6 +9653,18 @@ normalize-selector@^0.2.0:
resolved "https://registry.npmjs.org/normalize-selector/-/normalize-selector-0.2.0.tgz#d0b145eb691189c63a78d201dc4fdb1293ef0c03"
integrity sha512-dxvWdI8gw6eAvk9BlPffgEoGfM7AdijoCwOEJge3e3ulT2XLgmU7KvvxprOaCu05Q1uGRHmOhHe1r6emZoKyFw==

nostr-tools@^1.17.0:
version "1.17.0"
resolved "https://registry.yarnpkg.com/nostr-tools/-/nostr-tools-1.17.0.tgz#b6f62e32fedfd9e68ec0a7ce57f74c44fc768e8c"
integrity sha512-LZmR8GEWKZeElbFV5Xte75dOeE9EFUW/QLI1Ncn3JKn0kFddDKEfBbFN8Mu4TMs+L4HR/WTPha2l+PPuRnJcMw==
dependencies:
"@noble/ciphers" "0.2.0"
"@noble/curves" "1.1.0"
"@noble/hashes" "1.3.1"
"@scure/base" "1.1.1"
"@scure/bip32" "1.3.1"
"@scure/bip39" "1.2.1"

now-and-later@^2.0.0:
version "2.0.1"
resolved "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz#8e579c8685764a7cc02cb680380e94f43ccb1f7c"
Expand Down Expand Up @@ -10299,6 +10410,11 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==

qrcode-generator@^1.4.4:
version "1.4.4"
resolved "https://registry.yarnpkg.com/qrcode-generator/-/qrcode-generator-1.4.4.tgz#63f771224854759329a99048806a53ed278740e7"
integrity sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw==

qrcode.react@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8"
Expand Down Expand Up @@ -13700,3 +13816,10 @@ zustand@^4.3.1:
integrity sha512-4h28KCkHg5ii/wcFFJ5Fp+k1J3gJoasaIbppdgZFO4BPJnsNxL0mQXBSFgOgAdCdBj35aDTPvdAJReTMntFPGg==
dependencies:
use-sync-external-store "1.2.0"

zustand@^4.4.1:
version "4.4.6"
resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.4.6.tgz#03c78e3e2686c47095c93714c0c600b72a6512bd"
integrity sha512-Rb16eW55gqL4W2XZpJh0fnrATxYEG3Apl2gfHTyDSE965x/zxslTikpNch0JgNjJA9zK6gEFW8Fl6d1rTZaqgg==
dependencies:
use-sync-external-store "1.2.0"