Skip to content

Commit 5c50f5c

Browse files
prestwichclaude
andauthored
fix(ci): add --access public to npm publish for scoped packages (#16)
The v0.2.0 release workflow failed because scoped packages with npm provenance require --access public to be set explicitly. The GitHub release was created but npm publish failed. This PR: - Fixes the release workflow to include --access public - Bumps to v0.3.0 (v0.2.0 tag exists but was never published to npm) - Removes thin viem wrappers (passage, weth, witness helpers) per SDK scope - Documents direct viem usage patterns in README Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1660701 commit 5c50f5c

File tree

14 files changed

+133
-438
lines changed

14 files changed

+133
-438
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
else
5858
echo "New release needed"
5959
gh release create "$PKG_VER" -t "$PKG_VER" --generate-notes
60-
# publish to npm
61-
pnpm publish --no-git-checks
60+
# publish to npm (--access public required for scoped packages with provenance)
61+
pnpm publish --no-git-checks --access public
6262
# Add the release information to the github actions summary
6363
echo "# New Release Created" >> $GITHUB_STEP_SUMMARY
6464
echo "Tag: [$PKG_VER](https://github.com/${{ github.repository }}/releases/tag/${PKG_VER})" >> $GITHUB_STEP_SUMMARY

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
- **Breaking:** `needsWethWrap(symbol, direction, flow)` now requires a `flow` parameter to distinguish between Passage (direct ETH entry) and Orders (Permit2, requires WETH) flows
2121

22-
## [0.2.0] - 2026-02-05
22+
## [0.3.0] - 2026-02-05
2323

2424
### Added
2525

@@ -28,17 +28,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828
- Bundle serialization helpers (`serializeEthBundle`, `serializeCallBundle`)
2929
- Order feasibility checking (`checkOrderFeasibility`)
3030
- Tx-cache client (`createTxCacheClient`) for submitting orders and bundles
31-
- Passage helpers (`enter`, `enterToken`) for bridging to Signet
32-
- WETH helpers (`wrapEth`, `unwrapEth`) for wrapping/unwrapping ETH
33-
- Permit2 approval helpers (`getPermit2Allowance`, `approvePermit2`, `ensurePermit2Approval`)
31+
- Permit2 approval helpers (`ensurePermit2Approval`)
3432
- Token registry with USDC/USDT addresses for Mainnet and Parmigiana
3533
- Viem chain definitions (`signetRollup`, `parmigianaRollup`, `parmigianaHost`)
36-
- New subpath exports: `/client`, `/passage`, `/weth`, `/permit2`
34+
- New subpath exports: `/client`, `/permit2`
3735

3836
### Changed
3937

4038
- Expanded token mapping utilities (`getTokenAddress`, `resolveTokenSymbol`, `mapTokenCrossChain`)
4139

40+
### Fixed
41+
42+
- Release workflow now correctly publishes scoped packages to npm with `--access public`
43+
44+
### Note
45+
46+
- v0.2.0 was tagged but never published to npm due to a CI issue
47+
4248
## [0.1.0] - 2026-01-15
4349

4450
### Added

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,21 @@ Releases are automated via GitHub Actions. To release:
6363
2. Move `[Unreleased]` entries to a new version section in `CHANGELOG.md`
6464
3. Commit and push to `main`
6565
4. CI creates GitHub release and publishes to npm
66+
67+
## SDK Scope
68+
69+
The SDK focuses on:
70+
71+
- Types and type definitions
72+
- Contract ABIs
73+
- EIP-712 signing logic
74+
- Chain constants and addresses
75+
- Complex operations that add real value (validation, aggregation, edge case handling)
76+
77+
The SDK should NOT include:
78+
79+
- Thin wrappers around viem's `readContract`/`writeContract`
80+
- Simple parameter rearrangement helpers
81+
- Functions that just inject a constant into a viem call
82+
83+
Instead, export the ABIs and constants, then document direct viem usage patterns in README.

README.md

Lines changed: 82 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -96,86 +96,106 @@ console.log(`Order submitted with ID: ${id}`);
9696

9797
### On-Chain Operations
9898

99-
The SDK provides helpers for common on-chain operations:
99+
The SDK exports ABIs and constants for on-chain operations. Use viem directly for contract interactions:
100100

101-
#### Bridging with Passage
102-
103-
Enter Signet from the host chain:
101+
#### Permit2 Approvals
104102

105103
```typescript
106-
import { enter, enterToken, MAINNET } from "@signet-sh/sdk";
107-
import { createWalletClient, http } from "viem";
108-
import { mainnet } from "viem/chains";
104+
import { PERMIT2_ADDRESS } from "@signet-sh/sdk";
105+
import { erc20Abi, maxUint256 } from "viem";
109106

110-
const client = createWalletClient({
111-
account,
112-
chain: mainnet,
113-
transport: http(),
107+
// Approve Permit2 to spend your tokens (one-time per token)
108+
await walletClient.writeContract({
109+
address: tokenAddress,
110+
abi: erc20Abi,
111+
functionName: "approve",
112+
args: [PERMIT2_ADDRESS, maxUint256],
114113
});
115114

116-
// Bridge native ETH
117-
const hash = await enter(client, {
118-
passage: MAINNET.hostPassage,
119-
recipient: "0x...",
120-
amount: 1000000000000000000n, // 1 ETH
115+
// Check current allowance
116+
const allowance = await publicClient.readContract({
117+
address: tokenAddress,
118+
abi: erc20Abi,
119+
functionName: "allowance",
120+
args: [ownerAddress, PERMIT2_ADDRESS],
121+
});
122+
```
123+
124+
For tokens like USDT that require resetting allowance to zero before setting a new value, use `ensurePermit2Approval`:
125+
126+
```typescript
127+
import { ensurePermit2Approval } from "@signet-sh/sdk";
128+
129+
// Handles USDT-style tokens automatically
130+
const { approved, txHash } = await ensurePermit2Approval(
131+
walletClient,
132+
publicClient,
133+
{
134+
token: usdtAddress,
135+
owner: account.address,
136+
amount: 1000000n,
137+
}
138+
);
139+
```
140+
141+
#### Bridging with Passage
142+
143+
```typescript
144+
import { passageAbi, MAINNET } from "@signet-sh/sdk";
145+
146+
// Bridge native ETH to Signet
147+
await walletClient.writeContract({
148+
address: MAINNET.hostPassage,
149+
abi: passageAbi,
150+
functionName: "enter",
151+
args: [recipientAddress],
152+
value: 1000000000000000000n, // 1 ETH
121153
});
122154

123-
// Bridge ERC20 tokens (requires prior approval)
124-
const hash = await enterToken(client, {
125-
passage: MAINNET.hostPassage,
126-
rollupChainId: MAINNET.rollupChainId,
127-
recipient: "0x...",
128-
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
129-
amount: 1000000n, // 1 USDC
155+
// Bridge ERC20 tokens to Signet (requires prior token approval to Passage)
156+
await walletClient.writeContract({
157+
address: MAINNET.hostPassage,
158+
abi: passageAbi,
159+
functionName: "enterToken",
160+
args: [MAINNET.rollupChainId, recipientAddress, tokenAddress, amount],
130161
});
131162
```
132163

133164
#### WETH Wrapping
134165

135-
Convert between ETH and WETH:
136-
137166
```typescript
138-
import { wrapEth, unwrapEth, getTokenAddress, MAINNET } from "@signet-sh/sdk";
167+
import { wethAbi, getTokenAddress, MAINNET } from "@signet-sh/sdk";
139168

140169
const wethAddress = getTokenAddress("WETH", MAINNET.hostChainId, MAINNET)!;
141170

142171
// Wrap ETH → WETH
143-
await wrapEth(client, { weth: wethAddress, amount: 1000000000000000000n });
172+
await walletClient.writeContract({
173+
address: wethAddress,
174+
abi: wethAbi,
175+
functionName: "deposit",
176+
value: 1000000000000000000n, // 1 ETH
177+
});
144178

145179
// Unwrap WETH → ETH
146-
await unwrapEth(client, { weth: wethAddress, amount: 1000000000000000000n });
180+
await walletClient.writeContract({
181+
address: wethAddress,
182+
abi: wethAbi,
183+
functionName: "withdraw",
184+
args: [1000000000000000000n], // 1 WETH
185+
});
147186
```
148187

149-
#### Permit2 Approvals
150-
151-
Manage ERC20 approvals for Permit2:
188+
#### Reading Output Witness
152189

153190
```typescript
154-
import {
155-
getPermit2Allowance,
156-
approvePermit2,
157-
ensurePermit2Approval,
158-
} from "@signet-sh/sdk";
191+
import { rollupOrdersAbi, MAINNET } from "@signet-sh/sdk";
159192

160-
// Check current allowance
161-
const allowance = await getPermit2Allowance(publicClient, {
162-
token: usdcAddress,
163-
owner: account.address,
193+
const { witnessHash, witnessTypeString } = await publicClient.readContract({
194+
address: MAINNET.rollupOrders,
195+
abi: rollupOrdersAbi,
196+
functionName: "outputWitness",
197+
args: [outputs],
164198
});
165-
166-
// Approve Permit2 (max by default)
167-
await approvePermit2(walletClient, { token: usdcAddress });
168-
169-
// Smart approval - handles USDT-style tokens that require reset to zero
170-
const { approved, txHash } = await ensurePermit2Approval(
171-
walletClient,
172-
publicClient,
173-
{
174-
token: usdtAddress,
175-
owner: account.address,
176-
amount: 1000000n,
177-
}
178-
);
179199
```
180200

181201
### Chain Configurations
@@ -199,10 +219,8 @@ console.log(PARMIGIANA.rollupChainId); // 88888n
199219
import { MAINNET, PARMIGIANA } from "@signet-sh/sdk/constants";
200220
import { UnsignedOrder } from "@signet-sh/sdk/signing";
201221
import type { SignedOrder } from "@signet-sh/sdk/types";
202-
import { rollupOrdersAbi } from "@signet-sh/sdk/abi";
222+
import { rollupOrdersAbi, passageAbi, wethAbi } from "@signet-sh/sdk/abi";
203223
import { createTxCacheClient } from "@signet-sh/sdk/client";
204-
import { enter, enterToken } from "@signet-sh/sdk/passage";
205-
import { wrapEth, unwrapEth } from "@signet-sh/sdk/weth";
206224
import { ensurePermit2Approval } from "@signet-sh/sdk/permit2";
207225
```
208226

@@ -379,12 +397,6 @@ const balances = await Promise.all(
379397
- `serializeEthBundle(bundle)` - Serialize bundle for JSON-RPC
380398
- `serializeCallBundle(bundle)` - Serialize call bundle for JSON-RPC
381399
- `createTxCacheClient(url)` - Create a tx-cache client for bundle submission
382-
- `enter(client, params)` - Bridge native ETH to Signet via Passage
383-
- `enterToken(client, params)` - Bridge ERC20 tokens to Signet via Passage
384-
- `wrapEth(client, params)` - Wrap native ETH into WETH
385-
- `unwrapEth(client, params)` - Unwrap WETH back to native ETH
386-
- `getPermit2Allowance(client, params)` - Get ERC20 allowance for Permit2
387-
- `approvePermit2(client, params)` - Approve Permit2 to spend ERC20
388400
- `ensurePermit2Approval(walletClient, publicClient, params)` - Smart Permit2 approval with USDT handling
389401
- `getTokenDecimals(symbol, config?)` - Get token decimals with chain-specific overrides
390402
- `needsWethWrap(symbol, direction, flow)` - Check if ETH needs wrapping for operation
@@ -407,6 +419,13 @@ const balances = await Promise.all(
407419
- `MAINNET` - Mainnet chain configuration
408420
- `PARMIGIANA` - Parmigiana testnet configuration
409421

422+
### ABIs
423+
424+
- `passageAbi` - Passage bridge contract ABI
425+
- `wethAbi` - WETH contract ABI
426+
- `rollupOrdersAbi` - Rollup orders contract ABI
427+
- `permit2Abi` - Permit2 contract ABI
428+
410429
## Compatibility
411430

412431
This SDK produces signed orders that are byte-for-byte compatible with the Rust `signet-types` crate. The order hash computation matches exactly, ensuring interoperability between TypeScript and Rust implementations.

package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@signet-sh/sdk",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "TypeScript SDK for Signet Orders - create, sign, and verify orders compatible with signet-types",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -36,14 +36,6 @@
3636
"import": "./dist/client/index.js",
3737
"types": "./dist/client/index.d.ts"
3838
},
39-
"./passage": {
40-
"import": "./dist/passage/index.js",
41-
"types": "./dist/passage/index.d.ts"
42-
},
43-
"./weth": {
44-
"import": "./dist/weth/index.js",
45-
"types": "./dist/weth/index.d.ts"
46-
},
4739
"./permit2": {
4840
"import": "./dist/permit2/index.js",
4941
"types": "./dist/permit2/index.d.ts"

src/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ export {
119119
eip712SigningHash,
120120
encodeFillPermit2,
121121
encodeInitiatePermit2,
122-
getOutputWitness,
123122
hasPermit2Approval,
124123
isNonceUsed,
125124
nonceFromSeed,
@@ -169,15 +168,5 @@ export type { TxCacheClient } from "./client/index.js";
169168

170169
export { createTxCacheClient } from "./client/index.js";
171170

172-
// Passage
173-
export { enter, enterToken } from "./passage/index.js";
174-
175-
// WETH
176-
export { wrapEth, unwrapEth } from "./weth/index.js";
177-
178171
// Permit2 approvals
179-
export {
180-
getPermit2Allowance,
181-
approvePermit2,
182-
ensurePermit2Approval,
183-
} from "./permit2/index.js";
172+
export { ensurePermit2Approval } from "./permit2/index.js";

src/passage/index.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)