create-bch-dapp 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bch-dapp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,35 +1,35 @@
1
1
  "use client";
2
2
 
3
- import type { ReactNode } from "react";
4
- import { useEffect, useState } from "react";
5
- import { BCHConnectProvider, createConfig, CreatedConfig } from "bch-connect";
3
+ import { useEffect, useMemo, useState, type ReactNode } from "react";
4
+ import { BCHConnectProvider, createConfig } from "bch-connect";
6
5
 
7
6
  export function BCHConnectWrapper({ children }: { children: ReactNode }) {
8
- const [config, setConfig] = useState<CreatedConfig | null>(null);
7
+ const [mounted, setMounted] = useState<boolean>(false);
9
8
 
10
9
  useEffect(() => {
11
- if (config) return;
12
- const network =
13
- process.env.NEXT_PUBLIC_BCH_NETWORK === "testnet" ? "testnet" : "mainnet";
10
+ setMounted(true);
11
+ }, []);
14
12
 
15
- const projectId = process.env.NEXT_PUBLIC_REOWN_PROJECT_ID || "";
13
+ const config = useMemo(() => {
14
+ if (!mounted) return null;
16
15
 
17
- const cfg = createConfig({
18
- projectId,
19
- network,
16
+ return createConfig({
17
+ projectId: process.env.NEXT_PUBLIC_REOWN_PROJECT_ID || "",
18
+ network:
19
+ process.env.NEXT_PUBLIC_BCH_NETWORK === "testnet"
20
+ ? "testnet"
21
+ : "mainnet",
20
22
  metadata: {
21
23
  name: "BCH Connect Starter",
22
- description:
23
- "You can change this metadata in the app/BCHConnectWrapper.tsx file.",
24
- url: "http://localhost:3000",
25
- icons: ["http://localhost:3000/bch.svg"],
24
+ description: "Change this metadata in app/BCHConnectWrapper.tsx ",
25
+ url: window.location.origin,
26
+ icons: [`${window.location.origin}/bch.svg`],
26
27
  },
27
28
  });
29
+ }, [mounted]);
28
30
 
29
- setConfig(cfg);
30
- }, []);
31
-
32
- if (!config) return null;
33
-
31
+ if (!config) {
32
+ return null;
33
+ }
34
34
  return <BCHConnectProvider config={config}>{children}</BCHConnectProvider>;
35
35
  }
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 24.1.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 788 788" style="enable-background:new 0 0 788 788;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#0AC18E;}
7
+ .st1{fill:#FFFFFF;}
8
+ </style>
9
+ <circle class="st0" cx="394" cy="394" r="394"/>
10
+ <path id="symbol_1_" class="st1" d="M516.9,261.7c-19.8-44.9-65.3-54.5-121-45.2L378,147.1l-42.2,10.9l17.6,69.2
11
+ c-11.1,2.8-22.5,5.2-33.8,8.4L302,166.8l-42.2,10.9l17.9,69.4c-9.1,2.6-85.2,22.1-85.2,22.1l11.6,45.2c0,0,31-8.7,30.7-8
12
+ c17.2-4.5,25.3,4.1,29.1,12.2l49.2,190.2c0.6,5.5-0.4,14.9-12.2,18.1c0.7,0.4-30.7,7.9-30.7,7.9l4.6,52.7c0,0,75.4-19.3,85.3-21.8
13
+ l18.1,70.2l42.2-10.9l-18.1-70.7c11.6-2.7,22.9-5.5,33.9-8.4l18,70.3l42.2-10.9l-18.1-70.1c65-15.8,110.9-56.8,101.5-119.5
14
+ c-6-37.8-47.3-68.8-81.6-72.3C519.3,324.7,530,297.4,516.9,261.7L516.9,261.7z M496.6,427.2c8.4,62.1-77.9,69.7-106.4,77.2
15
+ l-24.8-92.9C394,404,482.4,372.5,496.6,427.2z M444.6,300.7c8.9,55.2-64.9,61.6-88.7,67.7l-22.6-84.3
16
+ C357.2,278.2,426.5,249.6,444.6,300.7z"/>
17
+ </svg>
@@ -6,8 +6,8 @@ export const config = createConfig({
6
6
  metadata: {
7
7
  name: "BCH Connect Starter",
8
8
  description: "You can change this metadata in the src/bchConnect.ts file.",
9
- url: "http://localhost:5173",
10
- icons: ["https://bitcoincash.org/img/green/bitcoin-cash-circle.svg"],
9
+ url: window.location.origin,
10
+ icons: [`${window.location.origin}/bch.svg`],
11
11
  },
12
12
  debug: true,
13
13
  });