adapter-connect 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +20 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,28 +10,43 @@ Trong `./layout.tsx` (hoặc `_app.tsx`), import CSS:
10
10
  import '@orderly.network/ui/dist/styles.css';
11
11
  ```
12
12
 
13
- ### Create env
14
- ```
15
- NEXT_PUBLIC_PRIVY_KEY= your_privy_key
16
- ```
13
+
17
14
 
18
15
  ### Cấu trúc bọc provider
19
16
 
20
17
  Toàn bộ app (hoặc phần cần dùng ví) nên được bọc bởi `WhatWagmiProvider` và `QueryClientProvider`:
21
18
 
22
19
  ```tsx
20
+ import {WhatWagmiProvider} from 'adapter-connect';
21
+
23
22
  <QueryClientProvider client={queryClient}>
24
- <WhatWagmiProvider>
23
+ <WhatWagmiProvider privyKey={process.env.NEXT_PUBLIC_PRIVY_KEY!}>
25
24
  {children}
26
25
  </WhatWagmiProvider>
27
26
  </QueryClientProvider>
28
27
  ```
29
28
 
29
+ or
30
+ ```
31
+ const WhatWagmiProvider = dynamic(
32
+ () => import('adapter-connect').then((mod) => ({ default: mod.WhatWagmiProvider })),
33
+ { ssr: false }
34
+ );
35
+ ```
36
+
30
37
  `WhatWagmiProvider` hiện đang:
31
38
  - Bọc app bằng `PrivyProvider` (auth + ví).
32
39
  - Khởi tạo `WagmiProvider` với chain `base`.
33
40
  - Render thêm `ModalPrivyConnect` để chọn ví / login.
34
41
 
42
+ ### Declare global functions
43
+ ```
44
+ Window {
45
+ window.openModalPrivyConnect: () => void;
46
+ window.openModalPrivyWallet: () => void;
47
+ }
48
+ ```
49
+
35
50
  ### Mở modal kết nối ví (Privy + wallet)
36
51
 
37
52
  Ở bất kỳ nơi nào trong client code, có thể gọi:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapter-connect",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",