Skip to content

Commit 983bc97

Browse files
committed
fix(ci): use npm publish for OIDC token exchange; remove conflux-cas refs; fix docs
1 parent 4ef15e4 commit 983bc97

File tree

19 files changed

+96
-92
lines changed

19 files changed

+96
-92
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Copy to .env and fill in real values. Never commit .env.
33
#
44
# This file is read by:
5-
# - conflux-contracts/hardhat.config.ts (dotenv path: '../.env')
6-
# - conflux-cas/scripts/deploy.ts (dotenv path: '../../.env')
5+
# - devtools/contracts/hardhat.config.ts (dotenv path: '../.env')
6+
# - devtools/contracts/scripts/deploy.ts (dotenv path: '../../.env')
77
#
88
# ─── Deployer wallet ──────────────────────────────────────────────────────────
99
# 0x-prefixed private key for the account that will deploy contracts.

.github/workflows/release.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,28 @@ jobs:
107107
name: build-artifacts
108108

109109
# ── 1. Publish all @cfxdevkit/* library packages ───────────────────────
110-
# pnpm handles topological publish order (respects workspace:* deps).
111-
# --no-git-checks skips the "working tree must be clean" check that
112-
# fails on tag checkouts.
110+
# IMPORTANT: Use `npm publish` (not `pnpm publish`) so the npm CLI can
111+
# automatically exchange the GitHub OIDC token for a short-lived npm
112+
# credential. `pnpm publish` does NOT trigger the OIDC token exchange,
113+
# which causes "Access token expired" + E404 even when trusted publishing
114+
# is correctly configured on npmjs.com.
115+
#
113116
# Provenance attestation is generated automatically by npm when publishing
114117
# via OIDC trusted publishing — no --provenance flag needed.
115118
- name: Publish @cfxdevkit/* packages
116119
run: |
117-
pnpm publish \
118-
--filter './packages/*' \
119-
--recursive \
120-
--access public \
121-
--no-git-checks \
122-
--report-summary
120+
for pkg_dir in packages/*/; do
121+
pkg_name=$(node -p "require('./${pkg_dir}package.json').name")
122+
echo "\n--- Publishing ${pkg_name} ---"
123+
npm publish "${pkg_dir}" --access public
124+
done
123125
124126
# ── 2. Publish the conflux-devkit CLI ──────────────────────────────────
125-
# Published separately (after the scoped packages) because its package.json
126-
# lists workspace:* deps that pnpm rewrites to real versions at publish time.
127-
# The CLI bundles all @cfxdevkit/* code via tsup noExternal so npm users
128-
# get a standalone binary — @cfxdevkit/* are in devDependencies, not deps.
129-
- name: Publish conflux-devkit CLI
127+
# `pnpm pack` normalises workspace:* dependency versions in package.json
128+
# to real semver before creating the tarball so the published package.json
129+
# is clean. We then hand the tarball to `npm publish` so the OIDC token
130+
# exchange still happens via the npm CLI.
131+
- name: Pack + Publish conflux-devkit CLI
130132
run: |
131-
pnpm publish \
132-
--filter conflux-devkit \
133-
--access public \
134-
--no-git-checks \
135-
--report-summary
133+
pnpm pack -C devtools/devkit --pack-destination .
134+
npm publish ./conflux-devkit-*.tgz --access public

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Thumbs.db
5050
._ignore/
5151

5252
# ── Certificates (local dev TLS) ─────────────────────────────────────────────
53-
conflux-cas/frontend/certificates/
53+
# (project-specific TLS certs or frontend artifacts)
5454

5555
# ── Dev-only artifacts (not part of submission) ───────────────────────────────
56-
conflux-cas/docs/DEVIATIONS.md
56+
# (project-specific deviation notes)

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ clients through to production-ready React components.
1212
packages/ Framework packages — all publishable to npm as @cfxdevkit/*
1313
core/ @cfxdevkit/core — RPC clients, contracts, HD wallet
1414
services/ @cfxdevkit/services — encryption, keystore, Swappi DEX
15-
wallet/ @cfxdevkit/wallet — re-export of wallet API from core
15+
wallet/ @cfxdevkit/wallet — focused wallet re-exports (session keys, batching)
1616
compiler/ @cfxdevkit/compiler — runtime solc-js + contract templates
1717
devnode/ @cfxdevkit/devnode — local @xcfx/node lifecycle (dev only)
18+
contracts/ @cfxdevkit/contracts — generated ABI, bytecode, addresses
19+
protocol/ @cfxdevkit/protocol — raw on-chain artifacts (ABIs + bytecode)
20+
executor/ @cfxdevkit/executor — on-chain execution/keeper runtime primitives
21+
defi-react/ @cfxdevkit/defi-react — React helpers for DeFi (pool tokens, pairs)
1822
react/ @cfxdevkit/react — headless React components + hooks
1923
wallet-connect/ @cfxdevkit/wallet-connect — wagmi v2 + ConnectKit + SIWE
20-
contracts/ @cfxdevkit/contracts — generated ABI, bytecode, addresses
2124
2225
devtools/ Private developer tooling — never published as framework packages
2326
contracts/ @cfxdevkit/contracts-dev — Hardhat project: Solidity sources,
@@ -44,15 +47,18 @@ docs/ API reference and architecture docs
4447
| Package | What it gives you |
4548
|---|---|
4649
| `@cfxdevkit/services` | AES-256 encryption, encrypted HD keystore (file-based), Swappi DEX swap |
47-
| `@cfxdevkit/wallet` | Focused re-export of `core`'s wallet API |
50+
| `@cfxdevkit/wallet` | Focused re-export of `core`'s wallet API (session keys, batching, embedded wallet) |
4851
| `@cfxdevkit/compiler` | Runtime Solidity compiler (solc-js), pre-built contract templates |
4952
| `@cfxdevkit/devnode` | Local `@xcfx/node` lifecycle: start/stop/mine/faucet — **dev and test only** |
5053
| `@cfxdevkit/contracts` | Generated ABI, bytecode, and deployed addresses for production contracts |
54+
| `@cfxdevkit/protocol` | Low-level on-chain artifacts (ABIs + bytecode) for tooling and scripts |
55+
| `@cfxdevkit/executor` | Keeper / execution primitives for on-chain strategy execution (Limit/DCA/TWAP) |
5156

5257
### Layer 2 — React UI
5358

5459
| Package | What it gives you |
5560
|---|---|
61+
| `@cfxdevkit/defi-react` | DeFi-specific React hooks: pool token resolution, balance enrichment, helpers |
5662
| `@cfxdevkit/wallet-connect` | wagmi v2 + ConnectKit + SIWE: `<WalletConnect>`, `AuthProvider`, chain constants |
5763
| `@cfxdevkit/react` | Headless render-prop components: `<ConnectButton>`, `<AccountCard>`, `<ContractReader>`, `<ContractWriter>`, `<SwapWidget>` |
5864

@@ -136,6 +142,10 @@ pnpm add @cfxdevkit/core # foundation — always needed
136142
pnpm add @cfxdevkit/services # encryption, keystore, swap
137143
pnpm add @cfxdevkit/wallet # wallet without full RPC layer
138144
pnpm add @cfxdevkit/compiler # runtime Solidity compilation
145+
pnpm add @cfxdevkit/contracts # generated ABIs + addresses
146+
pnpm add @cfxdevkit/protocol # low-level on-chain artifacts (bytecode + ABIs)
147+
pnpm add @cfxdevkit/executor # on-chain execution primitives (keepers)
148+
pnpm add @cfxdevkit/defi-react # DeFi React hooks + helpers
139149
pnpm add @cfxdevkit/devnode -D # local dev node (dev/test only)
140150
pnpm add @cfxdevkit/wallet-connect wagmi viem connectkit @tanstack/react-query
141151
pnpm add @cfxdevkit/react

devtools/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cfxdevkit/contracts-dev",
33
"version": "0.1.0",
4-
"description": "Solidity smart contracts for conflux-cas automation — Hardhat project with @wagmi/cli codegen for SDK",
4+
"description": "Solidity smart contracts for Conflux DevKit automation — Hardhat project with @wagmi/cli codegen for SDK",
55
"private": true,
66
"scripts": {
77
"compile": "hardhat compile",

devtools/contracts/scripts/check-wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* funded.
77
*
88
* Usage:
9-
* pnpm --filter @conflux-cas/contracts check-wallet
9+
* pnpm --filter @cfxdevkit/contracts-dev check-wallet
1010
*
1111
* No --network flag needed — the script creates its own providers.
1212
*/

devtools/contracts/scripts/verify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* Reads deployed addresses from env vars (set after running deploy.ts).
66
*
77
* Usage (testnet):
8-
* pnpm --filter @conflux-cas/contracts verify
8+
* pnpm --filter @cfxdevkit/contracts-dev verify
99
* Usage (mainnet):
10-
* pnpm --filter @conflux-cas/contracts verify:mainnet
10+
* pnpm --filter @cfxdevkit/contracts-dev verify:mainnet
1111
*
1212
* Required env vars:
1313
* AUTOMATION_MANAGER_ADDRESS

devtools/contracts/wagmi.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Plugin } from '@wagmi/cli';
66

77
// ─── Deployment registry ─────────────────────────────────────────────────────
88
// deployments.json is the single source of truth for deployed contract
9-
// addresses. Updated by conflux-cas/scripts/deploy.ts after each deploy.
9+
// addresses. Updated by devtools/contracts/scripts/deploy.ts after each deploy.
1010
// Committing this file tracks the canonical on-chain state per network.
1111
interface DeploymentRegistry {
1212
[chainId: string]: { [contractName: string]: string };
@@ -47,7 +47,7 @@ const wagmiDeployments = toWagmiDeployments(deploymentRegistry, CONTRACT_NAMES);
4747

4848
/**
4949
* Custom plugin — appends `as const` bytecode exports for each contract so
50-
* that `@cfxdevkit/sdk-automation` can expose them for programmatic deploys
50+
* that `@cfxdevkit/core/automation` can expose them for programmatic deploys
5151
* without pulling in Hardhat as a dependency.
5252
*/
5353
function hardhatBytecodePlugin(contractNames: string[]): Plugin {
@@ -57,7 +57,7 @@ function hardhatBytecodePlugin(contractNames: string[]): Plugin {
5757
const lines: string[] = [
5858
'',
5959
'// ─── Deployment bytecode ─────────────────────────────────────────────────────',
60-
'// Used by conflux-cas/scripts/deploy.ts via viem deployContract.',
60+
'// Used by devtools/contracts/scripts/deploy.ts via viem deployContract.',
6161
'// Regenerate with: pnpm contracts:codegen',
6262
];
6363
for (const name of contractNames) {
@@ -87,7 +87,7 @@ function hardhatBytecodePlugin(contractNames: string[]): Plugin {
8787
* Pipeline:
8888
* pnpm contracts:codegen (from monorepo root)
8989
* = hardhat compile → wagmi generate
90-
* → conflux-sdk/src/automation/generated.ts
90+
* → packages/contracts/src/generated.ts
9191
*
9292
* After a new deployment, update deployments.json then re-run codegen to
9393
* bake the new addresses into the SDK.

docs/PACKAGES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
UI Components ─── @cfxdevkit/react @cfxdevkit/wallet-connect
1313
Wallet logic ─── @cfxdevkit/wallet @cfxdevkit/core/wallet
1414
Services ─── @cfxdevkit/services
15-
RPC / Contracts─── @cfxdevkit/core
16-
Domain tools ─── @cfxdevkit/compiler @cfxdevkit/contracts
15+
RPC / Contracts─── @cfxdevkit/core @cfxdevkit/contracts
16+
Domain tools ─── @cfxdevkit/compiler @cfxdevkit/protocol
17+
Execution ─── @cfxdevkit/executor @cfxdevkit/defi-react
1718
Dev tools ─── @cfxdevkit/devnode conflux-devkit (npx)
1819
```
1920

packages/contracts/src/generated.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)