adapter-connect 0.0.2
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/README.md +55 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +964 -0
- package/dist/index.mjs +927 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
### Cài đặt UI package (tùy chọn, nếu dùng giao diện từ Orderly)
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm install @orderly.network/ui
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Trong `./layout.tsx` (hoặc `_app.tsx`), import CSS:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import '@orderly.network/ui/dist/styles.css';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Create env
|
|
14
|
+
```
|
|
15
|
+
NEXT_PUBLIC_PRIVY_KEY= your_privy_key
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Cấu trúc bọc provider
|
|
19
|
+
|
|
20
|
+
Toàn bộ app (hoặc phần cần dùng ví) nên được bọc bởi `WhatWagmiProvider` và `QueryClientProvider`:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<QueryClientProvider client={queryClient}>
|
|
24
|
+
<WhatWagmiProvider>
|
|
25
|
+
{children}
|
|
26
|
+
</WhatWagmiProvider>
|
|
27
|
+
</QueryClientProvider>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`WhatWagmiProvider` hiện đang:
|
|
31
|
+
- Bọc app bằng `PrivyProvider` (auth + ví).
|
|
32
|
+
- Khởi tạo `WagmiProvider` với chain `base`.
|
|
33
|
+
- Render thêm `ModalPrivyConnect` để chọn ví / login.
|
|
34
|
+
|
|
35
|
+
### Mở modal kết nối ví (Privy + wallet)
|
|
36
|
+
|
|
37
|
+
Ở bất kỳ nơi nào trong client code, có thể gọi:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
window.openModalPrivyConnect();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Lệnh trên sẽ mở `ModalPrivyConnect` để:
|
|
44
|
+
- Đăng nhập bằng Email / Google / Twitter.
|
|
45
|
+
- Kết nối ví EVM (MetaMask, WalletConnect, Brave, Binance, Privy wallet, ...).
|
|
46
|
+
|
|
47
|
+
### Mở modal chọn ví (wallet list riêng)
|
|
48
|
+
|
|
49
|
+
Ngoài `openModalPrivyConnect`, bạn có thể mở modal danh sách ví riêng (nếu được implement trong code) bằng:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
window.openModalPrivyWallet();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Tuỳ vào implementation, modal này có thể hiển thị danh sách ví EVM / Solana cụ thể để chọn nhanh.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
declare function WhatWagmiProvider({ children, privyKey }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
privyKey: string;
|
|
7
|
+
}): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { WhatWagmiProvider };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
declare function WhatWagmiProvider({ children, privyKey }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
privyKey: string;
|
|
7
|
+
}): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { WhatWagmiProvider };
|