@tokenops/sdk 2.0.0-alpha.2 → 2.0.0-alpha.3
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/CHANGELOG.md +39 -3
- package/README.md +11 -5
- package/dist/{chunk-PZZK3O3S.cjs → chunk-4AWQJQXY.cjs} +391 -43
- package/dist/{chunk-SPLNGUFF.js → chunk-4IB4IY5Y.js} +1 -1
- package/dist/{chunk-A4DCEE33.js → chunk-6HCT4QIX.js} +11 -10
- package/dist/{chunk-MM5BV5CS.cjs → chunk-6XOAYDC6.cjs} +4 -4
- package/dist/{chunk-FEDX7B6T.cjs → chunk-AHU2HMNE.cjs} +3 -3
- package/dist/{chunk-IGO5XSPS.js → chunk-BPIVVCSQ.js} +2 -2
- package/dist/{chunk-X7WBPCEU.js → chunk-BXX5TETM.js} +375 -27
- package/dist/{chunk-GADGBQJO.js → chunk-GCJFAY4X.js} +2 -2
- package/dist/{chunk-IUKKNJ2R.cjs → chunk-GKYZQJGP.cjs} +7 -7
- package/dist/{chunk-3YHBO2DL.cjs → chunk-IEKTGJ4J.cjs} +2 -2
- package/dist/{chunk-UHHMVBLU.cjs → chunk-JVNJSDQ4.cjs} +2 -2
- package/dist/{chunk-VW356KR3.js → chunk-LEYYG4RF.js} +126 -3
- package/dist/{chunk-PYYSB5ZN.js → chunk-NGU4JYIR.js} +1 -1
- package/dist/{chunk-FT5H2Q7Y.cjs → chunk-PG3WXT3K.cjs} +11 -10
- package/dist/{chunk-44YJPMQC.js → chunk-PK6Q6J5F.js} +1 -1
- package/dist/{chunk-EBLBPUPI.cjs → chunk-TND5NDV7.cjs} +18 -10
- package/dist/{chunk-EYDA6Q6C.js → chunk-U3TBQRT7.js} +10 -2
- package/dist/{chunk-WJMEBBU7.js → chunk-WRWRA4TN.js} +1 -1
- package/dist/{chunk-FHWSBGWE.cjs → chunk-YABHXJNH.cjs} +5 -5
- package/dist/{chunk-AREQJHKA.cjs → chunk-YTIYTV4K.cjs} +129 -2
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe-airdrop/abis/airdrop-base.d.ts +19 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +19 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +113 -0
- package/dist/fhe-airdrop/abis/merkle.d.ts +19 -0
- package/dist/fhe-airdrop/advanced/index.cjs +4 -4
- package/dist/fhe-airdrop/advanced/index.js +1 -1
- package/dist/fhe-airdrop/advanced/react/index.cjs +110 -80
- package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.js +34 -5
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +2 -1
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +4 -3
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +9 -7
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +6 -5
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +2 -1
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +5 -3
- package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +33 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +47 -8
- package/dist/fhe-airdrop/constants.d.ts +9 -1
- package/dist/fhe-airdrop/ecdsa.d.ts +13 -0
- package/dist/fhe-airdrop/errors.d.ts +59 -0
- package/dist/fhe-airdrop/factory.d.ts +62 -22
- package/dist/fhe-airdrop/guards.d.ts +87 -2
- package/dist/fhe-airdrop/index.cjs +67 -55
- package/dist/fhe-airdrop/index.d.cts +3 -3
- package/dist/fhe-airdrop/index.d.ts +3 -3
- package/dist/fhe-airdrop/index.js +4 -4
- package/dist/fhe-airdrop/react/index.cjs +237 -177
- package/dist/fhe-airdrop/react/index.d.cts +4 -1
- package/dist/fhe-airdrop/react/index.d.ts +4 -1
- package/dist/fhe-airdrop/react/index.js +72 -15
- package/dist/fhe-airdrop/react/keys.d.ts +8 -0
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
- package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
- package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
- package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/types.d.ts +13 -0
- package/dist/fhe-disperse/index.cjs +21 -21
- package/dist/fhe-disperse/index.js +2 -2
- package/dist/fhe-disperse/react/index.cjs +22 -22
- package/dist/fhe-disperse/react/index.js +3 -3
- package/dist/fhe-vesting/advanced/index.cjs +5 -5
- package/dist/fhe-vesting/advanced/index.js +3 -3
- package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
- package/dist/fhe-vesting/advanced/react/index.js +4 -4
- package/dist/fhe-vesting/index.cjs +8 -8
- package/dist/fhe-vesting/index.js +2 -2
- package/dist/fhe-vesting/react/index.cjs +114 -114
- package/dist/fhe-vesting/react/index.js +3 -3
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/index.cjs +14 -14
- package/dist/testnet-faucet/index.js +2 -2
- package/dist/testnet-faucet/react/index.cjs +8 -8
- package/dist/testnet-faucet/react/index.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,13 +5,49 @@ All notable changes to `@tokenops/sdk` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.0.0-alpha.3] - 2026-09-16
|
|
9
|
+
|
|
10
|
+
> **Pre-release built against internally-audited, externally-unaudited contracts.** Continues the `2.0.0-alpha` line. `/fhe-airdrop` in this build targets `tokenops-fhe-airdrop-v2` at commit `c5c12c2087f61bcd5bd1daa802563ed3cd68f002`, which closes the internal audit round (audit-03 through audit-16) but has not completed an external security audit. Every Sepolia `fheAirdrop` address moved again in this build. Breaking changes may land between any two alpha builds without a major bump (SemVer prerelease semantics). Published on the `alpha` dist-tag; `latest` stays on `1.6.0`. **For internal testing, not production value.**
|
|
11
|
+
>
|
|
12
|
+
> Migration guide: [`docs/migration/airdrop-v1-to-v2.md`](docs/migration/airdrop-v1-to-v2.md). Support policy: [`SUPPORT.md`](SUPPORT.md).
|
|
13
|
+
|
|
14
|
+
### Changed - BREAKING
|
|
15
|
+
|
|
16
|
+
- **`CommonAirdropParams` gains a required `maxAcceptedGasFee`.** The factory resolves the creator's per-claim fee at execution time and reverts `GasFeeNotAccepted` above this bound (audit-09). It is required rather than defaulted because the fee is frozen into the instance for its lifetime and the value that resolves is chosen by the factory's fee manager, not the creator - a default would hand that decision back to whoever is not making it. Pass `UINT96_MAX` (newly exported) to keep the previous behaviour of accepting any fee.
|
|
17
|
+
- **Every Sepolia `fheAirdrop` address moved.** CREATE3 returns a consumed salt's existing address without comparing codehashes, so the audit redeploy bumped the canonical salt version `2.0.0` → `2.0.2` rather than redeploying over itself. Instances created through the previous factory are unreachable from this release; a campaign planned against it fails `PredictionDriftError`.
|
|
18
|
+
- **`AirdropInitialized` gained a `uint256 gasFee` argument.** The SDK resolves creates from `ConfidentialAirdropCreated` and is unaffected, but any consumer filtering the old topic must re-derive it.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`factory.isAirdrop(candidate)`** and **`useIsAirdrop`** - the genuineness check (audit-10). Nothing readable at an instance proves which factory deployed it, and a claim against a look-alike **succeeds** and delivers nothing rather than reverting. `preflightClaim` gains an optional `factory` that folds the check in alongside every other blocker; supplying it turns the check on, omitting it leaves the existing call shape untouched. New `UnrecognisedAirdropError` (`TOKENOPS_UNRECOGNISED_AIRDROP`).
|
|
23
|
+
- **`refreshComplianceBalance()`** and **`useRefreshComplianceBalance`** - permissionless restoration of the compliance clone's live-balance grant (audit-04). The token rotates the instance's balance handle on every incoming transfer, including a direct one no airdrop code observes, so without this a campaign can be left with a clone that cannot read the pool and no admin around to fix it. The handle it returns is granted to the CLONE, not the caller.
|
|
24
|
+
- **`factory.setMaxGasFee` / `maxGasFee()`**, the factory's own ceiling on every configurable fee, gated by `DEFAULT_ADMIN_ROLE` rather than `FEE_MANAGER_ROLE` (audit-09). `useFactoryFees` now returns `maxGasFee` alongside `feeCollector` and `defaultGasFee`.
|
|
25
|
+
- **`factory.resolveGasFee(creator)`** - the number `maxAcceptedGasFee` is actually checked against, folding a per-creator override over the default. `GasFeeNotAcceptedError` carries it next to the declared bound, so a raised default is distinguishable from a custom override the creator did not know they had.
|
|
26
|
+
- **`useSetMaxGasFee`** (advanced/react) and **`useResolveGasFee`** (react). Every other factory fee control already had a hook; the ceiling did not, and composing the resolved fee by hand meant re-implementing the override-over-default rule in each consumer. `useSetDefaultGasFee`, `useSetCustomFee` and `useDisableCustomFee` now invalidate the resolved-fee key too.
|
|
27
|
+
- Revert mapping for `GasFeeNotAccepted`, `GasFeeExceedsMaximum` and `ZeroUnwrapRequestId`; `LastAdmin` and `ZeroAdminGrant` are now reachable from the factory as well as the instances.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **`getClaimAmount` was documented as a free, repeatable preview.** It now reverts once the claim is consumed, raising the consuming path's own error in the consuming path's own order (audit-07). The docs point availability checks at `isSignatureValid`, which never reverts.
|
|
32
|
+
- **`discloseHandleToParty` gate #1 now demands PERSISTENT user-decryption ACL on both legs** (audit-06). A handle fresh out of an FHE op carries only a transient allowance and no longer passes; the TSDoc names that trap rather than leaving it to be discovered.
|
|
33
|
+
- **`rescueERC20` refuses the campaign token** (audit-05). Our doc claimed it was out of reach because the pool is ERC-7984 - but a wrapper token answers both interfaces, so that was an assumption, not a guarantee.
|
|
34
|
+
- **The factory admin set can no longer be emptied** (audit-14). A test asserted the opposite; it and the `LastAdmin` message, which said "instance", are corrected.
|
|
35
|
+
- **`ContractCommonParams` is derived from the vendored ABI** instead of being a hand-written mirror. It carried a comment promising a struct change would surface as a type error - it did not, because every write path passes `unknown[]` at the viem edge. The next struct change now fails the build.
|
|
36
|
+
- `useCreateEcdsaAirdrop` and `useCreateMerkleAirdrop` spelled the registry query key inline rather than through `airdropKeys`, the drift `keys.ts` exists to prevent. All four create hooks now go through it and also invalidate `isAirdropAll`.
|
|
37
|
+
- **`preflightCreate` could reject instead of collecting.** An out-of-range `maxAcceptedGasFee` was collected as a blocker and then encoded anyway by the next read, so viem's `IntegerOutOfRangeError` escaped from a function documented never to throw. The range check now short-circuits before any ABI-dependent read, and the regression test uses a real viem client because the suite's mock harness bypasses encoding entirely.
|
|
38
|
+
- **The provenance check had no chain identity.** `preflightClaim` could be handed an instance on one chain and a factory on another, and a registry hit over there would read as a clean `true`. `AirdropRegistry` now carries `chainId` and a mismatch is refused before the registry is consulted.
|
|
39
|
+
- **`useIsAirdrop` cached a negative answer forever.** The registry is append-only so `true` is immutable, but `false` is not: the address can be created later by a process the hook never hears from. Only positive answers are cached now. The `address` override is also documented as what it is - the trust root for a security check.
|
|
40
|
+
- Factory role documentation still described the pre-audit-14 behaviour in four places (`factory.renounceRole`, `useFactoryRenounceRole`, `useFactoryRevokeRole`, `useFactoryRoleMembers`), telling UIs to plan for a state the factory now rejects. The compliance clone genuinely has no floor and is unchanged.
|
|
41
|
+
- `refreshComplianceBalance` was described as making the clone's read permanent. Append-only ACL keeps the returned handle readable, but the next incoming transfer rotates the instance onto a handle the clone was never granted on - it is a snapshot, not a subscription. Pinned by a local test that funds between two refreshes.
|
|
42
|
+
- Restored the create methods' error labels. A blanket ABI-name replacement had changed `error.context.method` from `createEcdsaAirdrop` / `createMerkleAirdrop` to the Solidity entrypoint names, pointing callers at methods they cannot call; a test now pins them.
|
|
43
|
+
|
|
8
44
|
## [2.0.0-alpha.2] - 2026-09-10
|
|
9
45
|
|
|
10
46
|
> **Pre-release built against unaudited contracts.** Continues the `2.0.0-alpha` line. `/fhe-airdrop` in this build targets `tokenops-fhe-airdrop-v2`, frozen at commit `7175ac82f467f0f88c05aba1a4536892999b4251`, which has not completed a final security audit. Every Sepolia `fheAirdrop` address moved in this build, and breaking changes may land between any two alpha builds without a major bump (SemVer prerelease semantics). Published on the `alpha` dist-tag; `latest` stays on `1.6.0`. **For internal testing, not production value.**
|
|
11
47
|
>
|
|
12
48
|
> Migration guide: [`docs/migration/airdrop-v1-to-v2.md`](docs/migration/airdrop-v1-to-v2.md). Support policy: [`SUPPORT.md`](SUPPORT.md).
|
|
13
49
|
|
|
14
|
-
### Changed
|
|
50
|
+
### Changed - BREAKING
|
|
15
51
|
|
|
16
52
|
- **`MerkleAirdropClient.claim` and `.getClaimAmount` submit an explicit claim identity.** The contracts gained a leading `address account`, which decoupled the leaf/accounting identity from the address the FHE input proof binds to. A relayer can now settle a leaf on a recipient's behalf.
|
|
17
53
|
- **`CampaignEntry` is `{ account, boundTo, handle, inputProof, merkleProof }`.** `recipient` is removed with **no alias**, as are `MerkleLeafInput.recipient` and `LeafOfArgs.recipient`. The field meant "leaf identity and submitter" at once and those are now different addresses, so an alias would have kept compiling while meaning something else. Entries serialised under `2.0.0-alpha.1` must be re-keyed; their handles remain valid, since leaf hashing did not change.
|
|
@@ -53,7 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
53
89
|
>
|
|
54
90
|
> Migration guide: [`docs/migration/airdrop-v1-to-v2.md`](docs/migration/airdrop-v1-to-v2.md). Support policy: [`SUPPORT.md`](SUPPORT.md).
|
|
55
91
|
|
|
56
|
-
### Changed
|
|
92
|
+
### Changed - BREAKING
|
|
57
93
|
|
|
58
94
|
- **`/fhe-airdrop` now targets confidential airdrop v2.** The subpath name is unchanged; everything behind it is new. v1 and v2 are different contract systems, not two versions of one — there is no in-place upgrade path for a deployed v1 airdrop. `AIRDROP_CONTRACTS_COMMIT` pins the contract commit the vendored ABIs were generated from.
|
|
59
95
|
- **`DEPLOYED_ADDRESSES.fheAirdrop` reshaped from one key to four.** Previously a single `confidentialAirdropFactory`; now `{ airdropFactory, ecdsaImplementation, merkleImplementation, complianceManagerImplementation }`. Code reading `DEPLOYED_ADDRESSES.fheAirdrop[chainId]` must read `.airdropFactory[chainId]`. Note this member is `@public`, not `@alpha` — it is the one breaking change outside the alpha-tagged surface.
|
|
@@ -227,7 +263,7 @@ _Tagged but never published — the release workflow failed on this tag; the con
|
|
|
227
263
|
- **`ConfidentialVestingFactoryClient.createManager`, `ConfidentialAirdropFactoryClient.createConfidentialAirdrop`, and `ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop` now block on `waitForTransactionReceipt` + `parseEventLogs` internally before resolving.** The returned `Create*Result` carries a fully-parsed `manager` / `airdrop` address when the promise resolves — callers no longer need a separate `waitForTransactionReceipt` + event-log scan after the call. Consumer-visible behavior change: if your code was doing `const { hash } = await createManager(...); const receipt = await waitForTransactionReceipt(hash)` you will now double-wait (harmless, but an extra round-trip). Drop the extra `waitForTransactionReceipt` call.
|
|
228
264
|
- **`createManagerAndGetAddress` and `createConfidentialAirdropAndGetAddress` are now passthroughs** — they no longer add a second wait step on top of the base creator. They remain exported as convenience aliases for consumers who discovered them first, but the base methods are the canonical entry point.
|
|
229
265
|
|
|
230
|
-
### Changed
|
|
266
|
+
### Changed - BREAKING (pre-1.0 publish)
|
|
231
267
|
|
|
232
268
|
The package has not been published to npm yet (`npm view @tokenops/sdk` returns 404), so the entries below land as direct shape changes rather than additive `*AndGetX` helpers.
|
|
233
269
|
|
package/README.md
CHANGED
|
@@ -46,10 +46,16 @@ The canonical exports map is in [`package.json`](https://github.com/VestingLabs/
|
|
|
46
46
|
|
|
47
47
|
Which contract generation a given SDK version talks to, and where that generation is deployed:
|
|
48
48
|
|
|
49
|
-
| SDK
|
|
50
|
-
|
|
|
51
|
-
| `2.0.0-alpha.
|
|
52
|
-
| `1.
|
|
49
|
+
| SDK | Airdrop contracts | Contract commit | Chains |
|
|
50
|
+
| ------------------------- | ------------------------ | --------------- | ------- |
|
|
51
|
+
| `2.0.0-alpha.3` | v2 (internal audit only) | `c5c12c2` | Sepolia |
|
|
52
|
+
| `2.0.0-alpha.1`-`alpha.2` | v2 (unaudited) | `7175ac8` | Sepolia |
|
|
53
|
+
| `1.x` | v1 | n/a | Sepolia |
|
|
54
|
+
|
|
55
|
+
Alpha builds are pinned to a contract generation, and every generation so far has moved every
|
|
56
|
+
deployed address. An instance created through one generation's factory is unreachable from a
|
|
57
|
+
build pinned to another - read `AIRDROP_CONTRACTS_COMMIT` at runtime to confirm which one you
|
|
58
|
+
have.
|
|
53
59
|
|
|
54
60
|
`2.x`'s `/fhe-airdrop` is a full replacement of v1, not an extension — see
|
|
55
61
|
[`docs/migration/airdrop-v1-to-v2.md`](docs/migration/airdrop-v1-to-v2.md) for the symbol-by-symbol
|
|
@@ -284,7 +290,7 @@ See [Confidential Vesting — React hooks on docs.tokenops.xyz](https://docs.tok
|
|
|
284
290
|
|
|
285
291
|
## Quickstart — confidential airdrop
|
|
286
292
|
|
|
287
|
-
> **v2,
|
|
293
|
+
> **v2, internally audited only.** `/fhe-airdrop` targets `tokenops-fhe-airdrop-v2` (`c5c12c2`, Sepolia only, `alpha` dist-tag) - see [Compatibility](#compatibility). Migrating from `1.x`? See [`docs/migration/airdrop-v1-to-v2.md`](docs/migration/airdrop-v1-to-v2.md).
|
|
288
294
|
|
|
289
295
|
Two claim-authorisation variants share one factory: **ECDSA** (an off-chain signature from a `SIGNER_ROLE` holder) and **Merkle** (inclusion in a published tree). The example below is ECDSA — see [`docs/fhe-airdrop/README.md`](docs/fhe-airdrop/README.md#quickstart--merkle-campaign) for the Merkle flow.
|
|
290
296
|
|