create-x402-conflux-app 0.2.1 → 0.2.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 +78 -14
- package/package.json +2 -2
- package/templates/core-base/examples/sandbox/package.json +2 -0
- package/templates/core-base/packages/express-middleware/package.json +1 -0
- package/templates/core-base/packages/facilitator/package.json +2 -0
- package/templates/core-base/tools/client/package.json +2 -0
package/README.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
# create-x402-app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Conflux x402 脚手架,用于快速生成可运行的支付项目。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 快速开始
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npx create-x402-app
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
向导会让你选择:
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
13
|
+
- 项目名
|
|
14
|
+
- 模板预设(`core` / `core+identity`)
|
|
15
|
+
- 网络(Mainnet/Testnet)
|
|
16
|
+
- 包管理器(pnpm/npm/yarn)
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## 模板预设
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### `core`(默认推荐)
|
|
21
|
+
生成核心支付链路:
|
|
21
22
|
|
|
22
23
|
- `packages/chain-config`
|
|
23
24
|
- `packages/facilitator`
|
|
@@ -25,18 +26,81 @@ The wizard asks for:
|
|
|
25
26
|
- `examples/sandbox`
|
|
26
27
|
- `tools/client`
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
### `core+identity`
|
|
30
|
+
在 `core` 基础上增加身份相关组件:
|
|
29
31
|
|
|
30
32
|
- `packages/attestor`
|
|
31
33
|
- `packages/contracts`
|
|
32
34
|
- `packages/identity-cli`
|
|
33
35
|
|
|
34
|
-
##
|
|
36
|
+
## 生成后如何运行
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
```bash
|
|
39
|
+
cd <your-project>
|
|
40
|
+
cp .env.example .env
|
|
41
|
+
pnpm install
|
|
42
|
+
pnpm build
|
|
43
|
+
pnpm dev:facilitator
|
|
44
|
+
pnpm dev:sandbox
|
|
45
|
+
pnpm start:client
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
兼容命令:`dev:server` 是 `dev:sandbox` 的别名。
|
|
49
|
+
|
|
50
|
+
## 可选能力(重点)
|
|
51
|
+
|
|
52
|
+
这些能力对商家都不是强制的,默认可按最小配置跑通。
|
|
53
|
+
|
|
54
|
+
### 1. Auth / Identity(可选)
|
|
55
|
+
|
|
56
|
+
默认(不启用):
|
|
57
|
+
|
|
58
|
+
- `AUTH_MODE=none`
|
|
59
|
+
- `AUTH_ENABLED=false`
|
|
60
|
+
|
|
61
|
+
启用后(需要 identity 组件):
|
|
62
|
+
|
|
63
|
+
- `AUTH_MODE=domain_gate`
|
|
64
|
+
- `AUTH_ENABLED=true`
|
|
65
|
+
- `IDENTITY_REGISTRY_ADDRESS=0x...`
|
|
66
|
+
|
|
67
|
+
### 2. Refund(可选)
|
|
68
|
+
|
|
69
|
+
默认(不启用):
|
|
70
|
+
|
|
71
|
+
- `REFUND_DEFAULT=off`
|
|
72
|
+
|
|
73
|
+
启用后:
|
|
74
|
+
|
|
75
|
+
- `REFUND_DEFAULT=on`
|
|
76
|
+
- `SERVER_PRIVATE_KEY=0x...`
|
|
77
|
+
|
|
78
|
+
### 3. 实际链上结算(可选)
|
|
79
|
+
|
|
80
|
+
默认安全模式:
|
|
81
|
+
|
|
82
|
+
- `VERIFY_ONLY_MODE=true`(只校验,不执行链上 settle)
|
|
83
|
+
|
|
84
|
+
需要真实结算时改为:
|
|
85
|
+
|
|
86
|
+
- `VERIFY_ONLY_MODE=false`
|
|
87
|
+
|
|
88
|
+
### 4. Discovery / Bazaar(可选)
|
|
89
|
+
|
|
90
|
+
如需链上发现能力,配置:
|
|
91
|
+
|
|
92
|
+
- `AGENT_REGISTRY_ADDRESS=0x...`
|
|
93
|
+
|
|
94
|
+
并可使用:
|
|
95
|
+
|
|
96
|
+
- `pnpm register:chart-agent`
|
|
97
|
+
|
|
98
|
+
## v0.2.0 结构变更
|
|
99
|
+
|
|
100
|
+
- 服务入口从 `packages/server` 切换为 `examples/sandbox`
|
|
101
|
+
- 保留 `dev:server` 兼容旧命令
|
|
38
102
|
|
|
39
|
-
##
|
|
103
|
+
## 本仓库开发(维护脚手架本身)
|
|
40
104
|
|
|
41
105
|
```bash
|
|
42
106
|
pnpm install
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-x402-conflux-app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffold CLI for Conflux x402 payment projects",
|
|
6
6
|
"bin": {
|
|
7
|
-
"create-x402-app": "
|
|
7
|
+
"create-x402-app": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
|
+
"predev": "pnpm --filter @{{PROJECT_NAME}}/chain-config build && pnpm --filter @{{PROJECT_NAME}}/express-middleware build",
|
|
10
11
|
"dev": "tsx --watch src/index.ts",
|
|
12
|
+
"prestart": "pnpm --filter @{{PROJECT_NAME}}/chain-config build && pnpm --filter @{{PROJECT_NAME}}/express-middleware build",
|
|
11
13
|
"start": "node dist/index.js",
|
|
12
14
|
"register:chart-agent": "tsx scripts/register-chart-agent.ts",
|
|
13
15
|
"test": "pnpm --filter @{{PROJECT_NAME}}/chain-config build && pnpm --filter @{{PROJECT_NAME}}/express-middleware build && pnpm build && node --test test/**/*.test.mjs"
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
|
+
"predev": "pnpm --filter @{{PROJECT_NAME}}/chain-config build",
|
|
10
11
|
"dev": "tsx --watch src/index.ts",
|
|
12
|
+
"prestart": "pnpm --filter @{{PROJECT_NAME}}/chain-config build",
|
|
11
13
|
"start": "node dist/index.js",
|
|
12
14
|
"test": "pnpm --filter @{{PROJECT_NAME}}/chain-config build && pnpm build && node --test test/**/*.test.mjs"
|
|
13
15
|
},
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
|
+
"prestart": "pnpm --filter @{{PROJECT_NAME}}/chain-config build",
|
|
10
11
|
"start": "tsx src/index.ts",
|
|
11
12
|
"start:manual": "tsx src/manual.ts",
|
|
13
|
+
"predev": "pnpm --filter @{{PROJECT_NAME}}/chain-config build",
|
|
12
14
|
"dev": "tsx --watch src/index.ts",
|
|
13
15
|
"test": "pnpm --filter @{{PROJECT_NAME}}/chain-config build && pnpm --filter @{{PROJECT_NAME}}/express-middleware build && pnpm --filter @{{PROJECT_NAME}}/sandbox build && pnpm build && node --test test/**/*.test.mjs"
|
|
14
16
|
},
|