@nexus-cross/dapp-ui 2.3.4-beta.1 → 2.4.0-beta.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/AI_INTEGRATION.md +55 -0
- package/README.md +52 -1
- package/dist/index.cjs +28 -21
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1528 -24
- package/dist/index.d.ts +1528 -24
- package/dist/index.js +28 -21
- package/dist/index.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AI Integration Contract
|
|
2
|
+
|
|
3
|
+
Use this file when an AI coding agent is asked to add `@nexus-cross/dapp-ui` to a React DApp.
|
|
4
|
+
|
|
5
|
+
## Get ONEUSD
|
|
6
|
+
|
|
7
|
+
Prefer the turn-key wagmi wrapper when the app already uses CROSSx Connect Kit:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import type { ReactNode } from "react";
|
|
11
|
+
import { CrossGetOneUsd } from "@nexus-cross/connect-kit-react";
|
|
12
|
+
|
|
13
|
+
export function AppLayout({ children }: { children: ReactNode }) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
{children}
|
|
17
|
+
<CrossGetOneUsd env="production" mode="floating" theme="dark" />
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Mount `CrossGetOneUsd` once in the persistent app/root layout, below
|
|
24
|
+
`CrossConnectKitProvider` and outside route pages. This keeps the floating
|
|
25
|
+
transaction status visible during same-site client-side route changes. A full
|
|
26
|
+
page reload or navigation to another site does not preserve an in-memory status.
|
|
27
|
+
|
|
28
|
+
Rules:
|
|
29
|
+
|
|
30
|
+
- Do not recreate the chooser, Swap, Bridge, Relay, History, Recover, APR, or transaction-status UI.
|
|
31
|
+
- Use `mode="floating"` for the fixed FAB and `mode="button"` for an inline trigger.
|
|
32
|
+
- In both modes, a submitted Swap/Bridge status is always rendered as a floating status surface.
|
|
33
|
+
- Use `buttonComponent` only when the host must supply a styled button component.
|
|
34
|
+
- Keep the component mounted while a transaction is pending; do not conditionally render it per route.
|
|
35
|
+
- `GetOneUsd` reads the S3 `getOneUsd.modes` flags. Missing flags default to Swap `true`, Bridge `true`, Transfer Crypto `false`.
|
|
36
|
+
- The Transfer Crypto modal owns the `Deposit`, `History`, and `Recover` tabs. It shares one live orders subscription across them.
|
|
37
|
+
- `CrossGetOneUsd` supplies wagmi Bridge and Relay adapters. Do not duplicate those adapters in DApp code.
|
|
38
|
+
- Use the low-level `GetOneUsd` export only when the host already owns every `bridge` and `relay` function port required by its TypeScript props.
|
|
39
|
+
|
|
40
|
+
For an inline host-styled trigger:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
const GetOneUsdButton = styled.button`
|
|
44
|
+
border-radius: 12px;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
<CrossGetOneUsd
|
|
48
|
+
env="production"
|
|
49
|
+
mode="button"
|
|
50
|
+
buttonComponent={GetOneUsdButton}
|
|
51
|
+
/>;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Keep all visible user-facing copy in English. Let the package own its modal
|
|
55
|
+
copy, colors, mobile keyboard behavior, safe-area handling, and transaction lock.
|
package/README.md
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
CROSS 생태계 DApp 공통 UI 컴포넌트 패키지.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
공통 DApp 기능을 제공한다. 주요 진입점:
|
|
6
6
|
|
|
7
7
|
- **AppLauncher**: 글로벌 서비스 메뉴
|
|
8
8
|
- **WalletInfo**: 지갑 잔액·가격·등락률 조회 UI
|
|
9
9
|
- **WalletConnectModal**: 지갑 연결 모달/드로어 UI
|
|
10
10
|
- **WalletPortfolio**: 리워드·DEX 포지션 포트폴리오 UI
|
|
11
|
+
- **GetOneUsd**: Swap·Bridge·Relay를 묶은 ONEUSD 획득 플로팅/버튼 위젯
|
|
11
12
|
|
|
12
13
|
> 이전 패키지 이름: `cross-app-launcher` (`@nexus-cross/dapp-ui@0.0.1+` 부터 rename).
|
|
13
14
|
|
|
@@ -39,9 +40,17 @@ import {
|
|
|
39
40
|
WalletInfo,
|
|
40
41
|
WalletConnectModal,
|
|
41
42
|
WalletPortfolio,
|
|
43
|
+
GetOneUsd,
|
|
42
44
|
} from "@nexus-cross/dapp-ui";
|
|
43
45
|
```
|
|
44
46
|
|
|
47
|
+
## AI-assisted integration
|
|
48
|
+
|
|
49
|
+
Give an AI coding agent [`AI_INTEGRATION.md`](./AI_INTEGRATION.md) as the
|
|
50
|
+
implementation contract. It contains the canonical Get ONEUSD mount location,
|
|
51
|
+
route-persistent floating transaction status rule, mode behavior, and the
|
|
52
|
+
boundary between `CrossGetOneUsd` and the low-level `GetOneUsd` ports.
|
|
53
|
+
|
|
45
54
|
---
|
|
46
55
|
|
|
47
56
|
## AppLauncher
|
|
@@ -173,6 +182,7 @@ Context Provider + Popover/Drawer Root.
|
|
|
173
182
|
| `showQR` | `boolean` | `true` | QR 코드 버튼/뷰 활성화 여부 |
|
|
174
183
|
| `onCopyAddress` | `(address: string, success: boolean) => void` | - | 주소 복사 콜백 (토스트 표시용) |
|
|
175
184
|
| `onBuy` | `() => void` | - | 기본 액션 row의 Buy 클릭 핸들러 |
|
|
185
|
+
| `showOnePop` | `boolean` | `true` | 액션 row의 ONEpop 카드 + ONEpop 화면 노출 (아래 참조) |
|
|
176
186
|
| `onDisconnect` | `() => void` | - | 지정 시 하단에 기본 Disconnect(Log Out) 버튼 렌더 |
|
|
177
187
|
| `disconnectLabel` | `string` | `'Disconnect'` | 기본 Disconnect 버튼 라벨 |
|
|
178
188
|
| `open` | `boolean` | - | 외부에서 열림 상태를 제어 (controlled) |
|
|
@@ -230,6 +240,47 @@ Log Out 처리는 레이아웃 목표에 따라 택일한다: **(A)** 단독 Dis
|
|
|
230
240
|
| ---------- | ----------- | ------- | ----------- |
|
|
231
241
|
| `children` | `ReactNode` | (필수) | 푸터 콘텐츠 |
|
|
232
242
|
|
|
243
|
+
### ONEpop 화면
|
|
244
|
+
|
|
245
|
+
기본 액션 row는 **Buy / Bridge / ONEpop / Portfolio** 이고, Send는 총자산 금액
|
|
246
|
+
우측의 아이콘 버튼이다. ONEpop 카드를 누르면 소셜 핸들 드롭 진입 화면이 열린다.
|
|
247
|
+
|
|
248
|
+
이 화면은 **렌더링만** 한다 — dapp-ui는 `@nexus-cross/pop`(viem 필수)에 의존할
|
|
249
|
+
수 없고, one-pop-api `/drops`·`/histories`는 SIWE 서명을 요구하기 때문이다.
|
|
250
|
+
표시할 상태와 액션 목적지는 주입받는다.
|
|
251
|
+
|
|
252
|
+
| Prop | Type | Description |
|
|
253
|
+
| ------------------- | --------------- | ------------------------------------------------------------------ |
|
|
254
|
+
| `showOnePop` | `boolean` | ONEpop 카드/화면 노출 (기본 `true`) |
|
|
255
|
+
| `onePopSummary` | `OnePopSummary` | 수령 대기 수·합계, replies 카운트, 최근 활동. 미주입 시 온보딩 화면 |
|
|
256
|
+
| `onOnePopOpen` | `() => void` | 화면 진입 시 호출 — 조회를 이 시점까지 미루는 트리거 |
|
|
257
|
+
| `onOnePopSend` | `() => void` | Send POP 카드 + "Send your first POP!" |
|
|
258
|
+
| `onOnePopClaim` | `() => void` | Claim POPs 카드 + 수령 대기 배너 |
|
|
259
|
+
| `onOnePopActivity` | `() => void` | Activity 카드 + "See all activity" + replies 배너 |
|
|
260
|
+
| `onePopLogoSrc` | `string` | 브랜드 워드마크 이미지 (미지정 시 내장 SVG) |
|
|
261
|
+
| `onePopHeroSrc` | `string` | 히어로 일러스트 이미지 (미지정 시 내장 SVG) |
|
|
262
|
+
|
|
263
|
+
미주입 콜백의 버튼은 비활성으로 보인다. `Available` 카드는 지갑이 이미 불러온
|
|
264
|
+
CROSS 체인 ONEUSD 잔액을 그대로 쓰고, `Get ONEUSD ›`는 `onBuy`(on-ramp)를
|
|
265
|
+
재사용한다.
|
|
266
|
+
|
|
267
|
+
`@nexus-cross/connect-kit-react`를 쓰고 `onePopEnabled: true`면
|
|
268
|
+
`onePopSummary`가 자동 주입된다. 자세한 내용은 `docs/dapp-ui/onepop.md`.
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
<WalletInfo
|
|
272
|
+
walletAddress={address}
|
|
273
|
+
showBalance
|
|
274
|
+
onePopSummary={summary}
|
|
275
|
+
onOnePopSend={() => router.push('/onepop/send')}
|
|
276
|
+
onOnePopClaim={() => router.push('/onepop/claim')}
|
|
277
|
+
onOnePopActivity={() => router.push('/onepop/activity')}
|
|
278
|
+
>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
`OnePopSummary`의 금액 필드는 raw wei-scale 문자열(`amountRaw` /
|
|
282
|
+
`claimableTotalRaw`) + `decimals` 로 받는다 — 표시 시 소수점 2자리 버림.
|
|
283
|
+
|
|
233
284
|
### 토큰 노출 정책
|
|
234
285
|
|
|
235
286
|
| 규칙 | 설명 |
|