@tokenops/sdk 2.0.0-alpha.1 → 2.0.0-alpha.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/CHANGELOG.md +29 -0
- package/README.md +5 -5
- package/dist/{chunk-JZLGCTGK.cjs → chunk-3YHBO2DL.cjs} +2 -2
- package/dist/{chunk-H5POPGOZ.js → chunk-44YJPMQC.js} +1 -1
- package/dist/{chunk-DZHYSUGY.js → chunk-A4DCEE33.js} +11 -5
- package/dist/{chunk-M4IT6DNJ.cjs → chunk-AREQJHKA.cjs} +108 -3
- package/dist/chunk-EBLBPUPI.cjs +255 -0
- package/dist/chunk-EYDA6Q6C.js +245 -0
- package/dist/{chunk-XAYGD4E4.cjs → chunk-FEDX7B6T.cjs} +3 -3
- package/dist/{chunk-JQYC66TO.cjs → chunk-FHWSBGWE.cjs} +5 -5
- package/dist/{chunk-5576FRT3.cjs → chunk-FT5H2Q7Y.cjs} +11 -5
- package/dist/{chunk-456VDDA3.js → chunk-GADGBQJO.js} +78 -25
- package/dist/{chunk-6NAVMWZQ.js → chunk-IGO5XSPS.js} +2 -2
- package/dist/{chunk-CTED3MTR.cjs → chunk-IUKKNJ2R.cjs} +82 -29
- package/dist/{chunk-FGEB7RMY.cjs → chunk-MM5BV5CS.cjs} +4 -4
- package/dist/{chunk-335Z2W67.js → chunk-PYYSB5ZN.js} +1 -1
- package/dist/{chunk-PUX5VXDB.cjs → chunk-PZZK3O3S.cjs} +1040 -42
- package/dist/{chunk-74QFZ5MK.js → chunk-SPLNGUFF.js} +1 -1
- package/dist/{chunk-6PXXGACR.cjs → chunk-UHHMVBLU.cjs} +2 -2
- package/dist/{chunk-O5676ZWY.js → chunk-VW356KR3.js} +108 -5
- package/dist/{chunk-EAJ7SYHE.js → chunk-WJMEBBU7.js} +1 -1
- package/dist/{chunk-GKKDAW44.js → chunk-X7WBPCEU.js} +1026 -32
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/types.d.ts +2 -2
- package/dist/fhe-airdrop/abis/merkle.d.ts +24 -12
- 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 +590 -9
- package/dist/fhe-airdrop/advanced/react/index.d.cts +34 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/index.js +561 -7
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
- package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +8 -0
- package/dist/fhe-airdrop/campaign.d.ts +61 -20
- package/dist/fhe-airdrop/constants.d.ts +1 -1
- package/dist/fhe-airdrop/errors.d.ts +28 -0
- package/dist/fhe-airdrop/guards.d.ts +46 -2
- package/dist/fhe-airdrop/index.cjs +74 -971
- package/dist/fhe-airdrop/index.d.cts +2 -2
- package/dist/fhe-airdrop/index.d.ts +2 -2
- package/dist/fhe-airdrop/index.js +8 -927
- package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
- package/dist/fhe-airdrop/merkle.d.ts +52 -31
- package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
- package/dist/fhe-airdrop/react/index.cjs +934 -84
- package/dist/fhe-airdrop/react/index.d.cts +49 -3
- package/dist/fhe-airdrop/react/index.d.ts +49 -3
- package/dist/fhe-airdrop/react/index.js +825 -22
- package/dist/fhe-airdrop/react/keys.d.ts +90 -0
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
- package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
- package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
- package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
- package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
- package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
- package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
- package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
- package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
- package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
- package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
- package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
- package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
- package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/types.d.ts +14 -1
- 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/dist/chunk-NCVX3K2N.cjs +0 -161
- package/dist/chunk-VP2B4WM2.js +0 -154
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ 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.2] - 2026-09-10
|
|
9
|
+
|
|
10
|
+
> **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
|
+
>
|
|
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
|
+
- **`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
|
+
- **`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.
|
|
18
|
+
- **Every Sepolia `fheAirdrop` address moved.** `claim`'s breaking signature forced a fresh Merkle implementation and the deploy script redeploys the whole system, factory included. Instances created through the previous factory are unreachable from this release, and a campaign planned against it now fails `PredictionDriftError`.
|
|
19
|
+
- `claimAndUnwrap` is deliberately **unchanged** and remains submitted for the caller: publishing an allocation as a plain ERC-20 transfer is the recipient's own choice, so a relayed unwrap is unrepresentable rather than rejected. A `submitter`-bound campaign therefore has no unwrap path.
|
|
20
|
+
- `SenderNotAllowedToUseHandle` is gone from the Merkle ABI — that path no longer calls `FHE.fromExternal`.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Batched relayed rosters are chunked at 32 recipients**, the 2048-bit input-ciphertext limit for `euint64`. `@zama-fhe/sdk` does not enforce it client-side, so an unchunked batch would have failed inside the prover; each chunk's proof is bound to the same submitter, so claims are unaffected.
|
|
25
|
+
- **`submitter?: Address` on every campaign builder** (`CampaignSubmitterOption`, accepted by `buildMerkleCampaign`, `encryptCampaignAmounts`, `planMerkleCampaign` and `rotateMerkleRoot`). Omitted keeps per-recipient binding; set binds the whole roster to one address under a single `encryptUint64Batch` call with one shared `inputProof`. The two shapes are mutually exclusive because an input proof carries exactly one `userAddress`, which is why bulk distribution needs a relayer. Shaped so a per-recipient `submitters?: Address[]` stays additive.
|
|
26
|
+
- **`UnauthorizedRedirectError`** (`TOKENOPS_UNAUTHORIZED_REDIRECT`), carrying `account`, `to` and `submitter` — the relation is the error, so blaming a single argument would mislead. Thrown before the write and mapped from the contract revert. `ZeroAccount` maps to `InvalidArgumentError`.
|
|
27
|
+
- **72 React hooks**, completing parity with the headless surface. Recipient, creator, campaign-owner and compliance-manager tiers on `@tokenops/sdk/fhe-airdrop/react`; the factory-admin tier (fee setters, implementation pointers, policy setters) on `@tokenops/sdk/fhe-airdrop/advanced/react`. Includes the encrypted-view mutations (`useAccessMerkleClaimAmount`, `useAccessEcdsaClaimAmount`, `useAdminGetCurrentBalance` and the disclosure family) that submit a transaction and return a handle recovered from the receipt.
|
|
28
|
+
- `useMemoComplianceManagerClient`, so the compliance-manager surface has a hook path at all.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **`useMerkleClaim` invalidated the wrong account.** It keyed `getClaimedAmount` on the transaction sender; the contract keys `claimedAmount` on the claim identity, so every relayed claim invalidated the relayer's cache entry and left the recipient's read stale.
|
|
33
|
+
- **`getClaimAmount` extracted the ACL handle for the wrong grantee.** The contract grants the outstanding handle to `account`, never the caller, so a relayed preview threw `ReceiptEventNotFoundError` after its transaction had already been mined. Silent on the self-preview path.
|
|
34
|
+
- The vendored local-fixture bytecode was a commit behind the vendored ABIs, so local Merkle suites deployed an implementation carrying the old `claim` selector.
|
|
35
|
+
- The ABI generator now emits `@alpha` itself, instead of relying on a hand-added tag that every regeneration silently dropped.
|
|
36
|
+
|
|
8
37
|
## [1.6.0](https://github.com/VestingLabs/tokenops-sdk/compare/v1.5.1...v1.6.0) (2026-07-28)
|
|
9
38
|
|
|
10
39
|
### Features
|
package/README.md
CHANGED
|
@@ -32,9 +32,9 @@ All subpaths are independently tree-shakeable. The `/react` paths keep React dep
|
|
|
32
32
|
| `@tokenops/sdk/fhe-vesting/advanced` | stable | Pre-mine address prediction (`predictManagerAddress`) |
|
|
33
33
|
| `@tokenops/sdk/fhe-vesting/advanced/react` | stable | React hooks for advanced vesting flows |
|
|
34
34
|
| `@tokenops/sdk/fhe-airdrop` | **v2, unaudited** — `alpha` dist-tag, factory live on Sepolia | ECDSA + Merkle confidential airdrop campaigns — see [Compatibility](#compatibility) |
|
|
35
|
-
| `@tokenops/sdk/fhe-airdrop/react` | **v2, unaudited** | React/wagmi hooks for
|
|
35
|
+
| `@tokenops/sdk/fhe-airdrop/react` | **v2, unaudited** | React/wagmi hooks for recipients, campaign creators, campaign owners and the compliance manager |
|
|
36
36
|
| `@tokenops/sdk/fhe-airdrop/advanced` | **v2, unaudited** | Prediction-freshness / salt-availability guards for CREATE2 address prediction (prediction itself is on the headline `ConfidentialAirdropFactoryClient`) |
|
|
37
|
-
| `@tokenops/sdk/fhe-airdrop/advanced/react` | **v2, unaudited** |
|
|
37
|
+
| `@tokenops/sdk/fhe-airdrop/advanced/react` | **v2, unaudited** | Address-prediction hooks plus the factory-admin tier (fee setters, implementation pointers, policy setters) |
|
|
38
38
|
| `@tokenops/sdk/fhe-disperse` | singleton live on mainnet + Sepolia | DisperseConfidential (singleton + per-user wallet-pair clones) |
|
|
39
39
|
| `@tokenops/sdk/fhe-disperse/react` | stable | React/wagmi hooks for confidential disperse |
|
|
40
40
|
| `@tokenops/sdk/testnet-faucet` | token pair live on Sepolia | Testnet faucet for the TokenOps test-token pair — TTT (plain ERC-20) + CTTT (ERC-7984 wrapper); open mint |
|
|
@@ -48,7 +48,7 @@ Which contract generation a given SDK version talks to, and where that generatio
|
|
|
48
48
|
|
|
49
49
|
| SDK | Airdrop contracts | Contract commit | Chains |
|
|
50
50
|
| --------------- | ------------------ | --------------- | ------- |
|
|
51
|
-
| `2.0.0-alpha.x` | v2 (**unaudited**) | `
|
|
51
|
+
| `2.0.0-alpha.x` | v2 (**unaudited**) | `7175ac8` | Sepolia |
|
|
52
52
|
| `1.x` | v1 | n/a | Sepolia |
|
|
53
53
|
|
|
54
54
|
`2.x`'s `/fhe-airdrop` is a full replacement of v1, not an extension — see
|
|
@@ -284,7 +284,7 @@ See [Confidential Vesting — React hooks on docs.tokenops.xyz](https://docs.tok
|
|
|
284
284
|
|
|
285
285
|
## Quickstart — confidential airdrop
|
|
286
286
|
|
|
287
|
-
> **v2, unaudited.** `/fhe-airdrop` targets `tokenops-fhe-airdrop-v2` (`
|
|
287
|
+
> **v2, unaudited.** `/fhe-airdrop` targets `tokenops-fhe-airdrop-v2` (`7175ac8`, 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
288
|
|
|
289
289
|
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
290
|
|
|
@@ -524,7 +524,7 @@ function RecipientClaim({
|
|
|
524
524
|
}
|
|
525
525
|
```
|
|
526
526
|
|
|
527
|
-
See [`docs/fhe-airdrop/README.md`](docs/fhe-airdrop/README.md) for the full hook catalogue
|
|
527
|
+
See [`docs/fhe-airdrop/README.md`](docs/fhe-airdrop/README.md) for the full hook catalogue across both import paths (`/fhe-airdrop/react` for recipients, creators, owners and compliance; `/fhe-airdrop/advanced/react` for prediction and factory admin), encryptor wiring, address overrides, and query-key reference.
|
|
528
528
|
|
|
529
529
|
## Quickstart — confidential disperse
|
|
530
530
|
|
|
@@ -4,7 +4,7 @@ var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
|
|
|
4
4
|
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
5
5
|
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
6
6
|
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
|
|
8
8
|
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
9
9
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
10
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
@@ -2052,7 +2052,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2052
2052
|
this.#telemetry = config.telemetry;
|
|
2053
2053
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
2054
2054
|
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
2055
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
2055
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getFheDisperseSingletonAddress(chainId));
|
|
2056
2056
|
if (!resolved) {
|
|
2057
2057
|
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
2058
2058
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
@@ -2,7 +2,7 @@ import { mapZamaError } from './chunk-WMACINXO.js';
|
|
|
2
2
|
import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-ZWXJTBZO.js';
|
|
3
3
|
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
4
4
|
import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
|
|
5
|
-
import { getFheDisperseSingletonAddress } from './chunk-
|
|
5
|
+
import { getFheDisperseSingletonAddress } from './chunk-A4DCEE33.js';
|
|
6
6
|
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
7
7
|
import { asExternalInputProof, asEncryptedHandle } from './chunk-KWFFIJYX.js';
|
|
8
8
|
import { InvalidArgumentError, TokenOpsSdkError, DeploymentAddressUnavailableError, PausedError, InsufficientFeeError, MissingEncryptorError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, BatchTooLargeError } from './chunk-QBJ7O2B4.js';
|
|
@@ -8,22 +8,28 @@ var DEPLOYED_ADDRESSES = {
|
|
|
8
8
|
// mainnet omitted — not deployed.
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
-
// Airdrop v2 (tokenops-fhe-airdrop-v2 @
|
|
11
|
+
// Airdrop v2 (tokenops-fhe-airdrop-v2 @ 7175ac8). The four contracts deploy
|
|
12
12
|
// together in one scripted run, so a chain either has all of them or none —
|
|
13
13
|
// which is what `chainsWithDeployment` assumes.
|
|
14
|
+
//
|
|
15
|
+
// Every address moved at 7175ac8: `claim`'s breaking signature change forced a
|
|
16
|
+
// fresh Merkle implementation, and the run redeploys the whole system rather
|
|
17
|
+
// than repointing one implementation slot. A campaign planned against the old
|
|
18
|
+
// factory therefore predicts an address the new factory will never produce —
|
|
19
|
+
// `PredictionDriftError` is what catches that.
|
|
14
20
|
fheAirdrop: {
|
|
15
21
|
airdropFactory: {
|
|
16
|
-
[sepolia.id]: "
|
|
22
|
+
[sepolia.id]: "0x174A7CB40F64aBC4C95CecB4172A066Cf531e4E9"
|
|
17
23
|
// mainnet omitted — ZamaConfig-gated, not deployed.
|
|
18
24
|
},
|
|
19
25
|
ecdsaImplementation: {
|
|
20
|
-
[sepolia.id]: "
|
|
26
|
+
[sepolia.id]: "0xDeD7AB391f87B8F891F89AaEC64C7c9C800C6645"
|
|
21
27
|
},
|
|
22
28
|
merkleImplementation: {
|
|
23
|
-
[sepolia.id]: "
|
|
29
|
+
[sepolia.id]: "0x815E65Cdd707F07F09332537b47C530d0E87aAf5"
|
|
24
30
|
},
|
|
25
31
|
complianceManagerImplementation: {
|
|
26
|
-
[sepolia.id]: "
|
|
32
|
+
[sepolia.id]: "0x885474FA494748C85410482244a406C6Ad570CCe"
|
|
27
33
|
}
|
|
28
34
|
},
|
|
29
35
|
fheDisperse: {
|
|
@@ -5,7 +5,7 @@ var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
|
|
7
7
|
// src/fhe-airdrop/constants.ts
|
|
8
|
-
var AIRDROP_CONTRACTS_COMMIT = "
|
|
8
|
+
var AIRDROP_CONTRACTS_COMMIT = "7175ac82f467f0f88c05aba1a4536892999b4251";
|
|
9
9
|
var DEPLOYMENT_MODE = { clone: 0, uups: 1 };
|
|
10
10
|
var DEDUP_MODE = { perAddress: 0, perDedupId: 1, both: 2, none: 3 };
|
|
11
11
|
|
|
@@ -37,6 +37,25 @@ var NonStockWrapperError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
var UnauthorizedRedirectError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
41
|
+
name = "UnauthorizedRedirectError";
|
|
42
|
+
constructor(args) {
|
|
43
|
+
const who = args?.submitter ? ` (submitter: ${args.submitter})` : "";
|
|
44
|
+
super(
|
|
45
|
+
`Only the claim identity may redirect its own payout${who}: \`to\` (${args?.to ?? "unknown"}) differs from \`account\` (${args?.account ?? "unknown"}) and the submitter is not that account. Leave \`to\` unset (or equal to \`account\`) when submitting on someone else's behalf.`,
|
|
46
|
+
{
|
|
47
|
+
code: "TOKENOPS_UNAUTHORIZED_REDIRECT",
|
|
48
|
+
cause: args?.cause,
|
|
49
|
+
context: {
|
|
50
|
+
constraint: "merkle-third-party-redirect",
|
|
51
|
+
account: args?.account,
|
|
52
|
+
to: args?.to,
|
|
53
|
+
submitter: args?.submitter
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
40
59
|
var SaltCollisionError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
41
60
|
name = "SaltCollisionError";
|
|
42
61
|
constructor(args) {
|
|
@@ -241,6 +260,22 @@ var airdropProductMapper = (name, errArgs, ctx) => {
|
|
|
241
260
|
});
|
|
242
261
|
case "RootImmutable":
|
|
243
262
|
return new chunk67OV5CX2_cjs.FeatureDisabledError({ ...ctx, feature: "merkleRootRotation" });
|
|
263
|
+
case "ZeroAccount":
|
|
264
|
+
return invalidArg(
|
|
265
|
+
ctx,
|
|
266
|
+
"account",
|
|
267
|
+
name,
|
|
268
|
+
"the claim identity is mandatory and is never defaulted from the caller"
|
|
269
|
+
);
|
|
270
|
+
case "UnauthorizedRedirect": {
|
|
271
|
+
const account = errArgs?.[0];
|
|
272
|
+
const to = errArgs?.[1];
|
|
273
|
+
return new UnauthorizedRedirectError({
|
|
274
|
+
account,
|
|
275
|
+
to,
|
|
276
|
+
submitter: ctx.productContext?.["creator"]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
244
279
|
// ---- FHEVM chain config ---------------------------------------------
|
|
245
280
|
case "ZamaProtocolUnsupported": {
|
|
246
281
|
const chainId = ctx.productContext?.["chainId"] ?? 0;
|
|
@@ -515,18 +550,86 @@ async function preflightCreate(args) {
|
|
|
515
550
|
}
|
|
516
551
|
return { ready: blockers.length === 0, blockers };
|
|
517
552
|
}
|
|
553
|
+
function assertMerkleClaimIdentity(args) {
|
|
554
|
+
const { method, account, submitter, boundTo, to, entrypoint = "claim" } = args;
|
|
555
|
+
for (const [argument, value] of [
|
|
556
|
+
["account", account],
|
|
557
|
+
["entry.boundTo", boundTo],
|
|
558
|
+
["to", to],
|
|
559
|
+
["submitter", submitter]
|
|
560
|
+
]) {
|
|
561
|
+
if (value !== void 0 && !viem.isAddress(value, { strict: false })) {
|
|
562
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
563
|
+
method,
|
|
564
|
+
argument,
|
|
565
|
+
reason: "is not a 20-byte hex address",
|
|
566
|
+
value
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (viem.isAddressEqual(account, viem.zeroAddress)) {
|
|
571
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
572
|
+
method,
|
|
573
|
+
argument: "account",
|
|
574
|
+
reason: "is the zero address; the claim identity is mandatory and is never defaulted from the caller"
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
if (boundTo !== void 0 && !viem.isAddressEqual(boundTo, submitter)) {
|
|
578
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
579
|
+
method,
|
|
580
|
+
argument: "entry.boundTo",
|
|
581
|
+
reason: `is ${boundTo}, but this transaction is sent from ${submitter}; the FHE input proof is bound to the sender, so only ${boundTo} can submit this entry`
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
if (entrypoint === "claimAndUnwrap") {
|
|
585
|
+
if (!viem.isAddressEqual(account, submitter)) {
|
|
586
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
587
|
+
method,
|
|
588
|
+
argument: "entry.account",
|
|
589
|
+
reason: `is ${account}, but \`claimAndUnwrap\` is always submitted for the caller (${submitter}); use \`claim\` to settle on someone else's behalf`
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const beneficiary = to === void 0 || viem.isAddressEqual(to, viem.zeroAddress) ? account : to;
|
|
595
|
+
if (!viem.isAddressEqual(beneficiary, account) && !viem.isAddressEqual(submitter, account)) {
|
|
596
|
+
throw new UnauthorizedRedirectError({ account, to: beneficiary, submitter });
|
|
597
|
+
}
|
|
598
|
+
}
|
|
518
599
|
async function preflightClaim(args) {
|
|
519
600
|
const { airdrop, claimant } = args;
|
|
520
601
|
const method = "preflightClaim";
|
|
521
602
|
const blockers = [];
|
|
522
603
|
collect(blockers, () => assertSupportedChain(airdrop.chainId));
|
|
523
|
-
|
|
604
|
+
if (args.account !== void 0 || args.entrypoint !== void 0) {
|
|
605
|
+
collect(
|
|
606
|
+
blockers,
|
|
607
|
+
() => assertMerkleClaimIdentity({
|
|
608
|
+
method,
|
|
609
|
+
account: args.account ?? claimant,
|
|
610
|
+
submitter: claimant,
|
|
611
|
+
to: args.to,
|
|
612
|
+
entrypoint: args.entrypoint
|
|
613
|
+
})
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
const [started, ended, paused, fee, balance, unwrappable] = await Promise.all([
|
|
524
617
|
airdrop.hasClaimStarted(),
|
|
525
618
|
airdrop.hasClaimEnded(),
|
|
526
619
|
airdrop.paused(),
|
|
527
620
|
airdrop.gasFee(),
|
|
528
|
-
airdrop.publicClient.getBalance({ address: claimant })
|
|
621
|
+
airdrop.publicClient.getBalance({ address: claimant }),
|
|
622
|
+
args.entrypoint === "claimAndUnwrap" && airdrop.unwrappable ? airdrop.unwrappable() : Promise.resolve(true)
|
|
529
623
|
]);
|
|
624
|
+
if (!unwrappable) {
|
|
625
|
+
blockers.push(
|
|
626
|
+
new chunk67OV5CX2_cjs.FeatureDisabledError({
|
|
627
|
+
method,
|
|
628
|
+
contractAddress: airdrop.address,
|
|
629
|
+
feature: "claimAndUnwrap"
|
|
630
|
+
})
|
|
631
|
+
);
|
|
632
|
+
}
|
|
530
633
|
if (paused) {
|
|
531
634
|
blockers.push(new chunk67OV5CX2_cjs.PausedError({ method, contractAddress: airdrop.address }));
|
|
532
635
|
}
|
|
@@ -597,8 +700,10 @@ exports.NonStockWrapperError = NonStockWrapperError;
|
|
|
597
700
|
exports.PredictionDriftError = PredictionDriftError;
|
|
598
701
|
exports.SaltCollisionError = SaltCollisionError;
|
|
599
702
|
exports.SignatureExpiredError = SignatureExpiredError;
|
|
703
|
+
exports.UnauthorizedRedirectError = UnauthorizedRedirectError;
|
|
600
704
|
exports.UpgradeabilityNotAllowedError = UpgradeabilityNotAllowedError;
|
|
601
705
|
exports.airdropProductMapper = airdropProductMapper;
|
|
706
|
+
exports.assertMerkleClaimIdentity = assertMerkleClaimIdentity;
|
|
602
707
|
exports.assertMerkleModeSupported = assertMerkleModeSupported;
|
|
603
708
|
exports.assertPredictionFresh = assertPredictionFresh;
|
|
604
709
|
exports.assertSaltAvailable = assertSaltAvailable;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPZZK3O3S_cjs = require('./chunk-PZZK3O3S.cjs');
|
|
4
|
+
var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
|
|
5
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var wagmi = require('wagmi');
|
|
8
|
+
|
|
9
|
+
var FHE_AIRDROP_KEY = "tokenops-sdk";
|
|
10
|
+
var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
|
|
11
|
+
function airdropQueryKey(params) {
|
|
12
|
+
return [
|
|
13
|
+
FHE_AIRDROP_KEY,
|
|
14
|
+
FHE_AIRDROP_NAMESPACE,
|
|
15
|
+
params.chainId ?? null,
|
|
16
|
+
params.address ? normalizeKeyArg(params.address) : null,
|
|
17
|
+
params.fn,
|
|
18
|
+
params.args.map(normalizeKeyArg)
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
function airdropQueryKeyPrefix(params) {
|
|
22
|
+
const prefix = [
|
|
23
|
+
FHE_AIRDROP_KEY,
|
|
24
|
+
FHE_AIRDROP_NAMESPACE,
|
|
25
|
+
params.chainId ?? null,
|
|
26
|
+
params.address ? normalizeKeyArg(params.address) : null
|
|
27
|
+
];
|
|
28
|
+
if (params.fn !== void 0) prefix.push(params.fn);
|
|
29
|
+
return prefix;
|
|
30
|
+
}
|
|
31
|
+
function normalizeKeyArg(value) {
|
|
32
|
+
if (typeof value === "bigint") return value.toString();
|
|
33
|
+
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
34
|
+
if (value && typeof value === "object") {
|
|
35
|
+
return Object.fromEntries(
|
|
36
|
+
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function tryResolveAirdropFactoryAddress(override, chainId) {
|
|
43
|
+
if (override) return override;
|
|
44
|
+
if (chainId === void 0) return void 0;
|
|
45
|
+
return chunkFT5H2Q7Y_cjs.getFheAirdropFactoryAddress(chainId);
|
|
46
|
+
}
|
|
47
|
+
function computeAirdropFactoryResolutionError(override, chainId) {
|
|
48
|
+
if (override) return void 0;
|
|
49
|
+
if (chainId === void 0) {
|
|
50
|
+
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
51
|
+
reason: "chain-id-missing",
|
|
52
|
+
product: "fheAirdrop",
|
|
53
|
+
contract: "airdropFactory",
|
|
54
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const resolved = chunkFT5H2Q7Y_cjs.getFheAirdropFactoryAddress(chainId);
|
|
58
|
+
if (!resolved) {
|
|
59
|
+
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
60
|
+
reason: "registry-not-deployed",
|
|
61
|
+
product: "fheAirdrop",
|
|
62
|
+
contract: "airdropFactory",
|
|
63
|
+
chainId,
|
|
64
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
function useMemoAirdropFactoryClient(opts = {}) {
|
|
70
|
+
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
71
|
+
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
72
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
73
|
+
const resolvedAddress = tryResolveAirdropFactoryAddress(opts.address, chainId);
|
|
74
|
+
const resolutionError = computeAirdropFactoryResolutionError(opts.address, chainId);
|
|
75
|
+
const encryptorSourceRef = react.useRef(opts.encryptor);
|
|
76
|
+
encryptorSourceRef.current = opts.encryptor;
|
|
77
|
+
const telemetry = opts.telemetry;
|
|
78
|
+
const client = react.useMemo(() => {
|
|
79
|
+
if (!publicClient) return void 0;
|
|
80
|
+
if (!resolvedAddress) return void 0;
|
|
81
|
+
return chunkPZZK3O3S_cjs.createConfidentialAirdropFactoryClient({
|
|
82
|
+
publicClient,
|
|
83
|
+
...walletClient ? { walletClient } : {},
|
|
84
|
+
address: resolvedAddress,
|
|
85
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
86
|
+
// Lazy — invoked per-encryption inside the headless client.
|
|
87
|
+
encryptor: () => chunkPZZK3O3S_cjs.resolveEncryptor(encryptorSourceRef.current),
|
|
88
|
+
...telemetry ? { telemetry } : {}
|
|
89
|
+
});
|
|
90
|
+
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
91
|
+
return {
|
|
92
|
+
client,
|
|
93
|
+
resolutionError,
|
|
94
|
+
publicClient,
|
|
95
|
+
walletClient: walletClient ?? void 0,
|
|
96
|
+
chainId,
|
|
97
|
+
resolvedAddress
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function useMemoAirdropBaseClient(opts) {
|
|
101
|
+
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
102
|
+
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
103
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
104
|
+
const telemetry = opts.telemetry;
|
|
105
|
+
const client = react.useMemo(() => {
|
|
106
|
+
if (!publicClient) return void 0;
|
|
107
|
+
if (!opts.address) return void 0;
|
|
108
|
+
return chunkPZZK3O3S_cjs.createAirdropBaseClient({
|
|
109
|
+
publicClient,
|
|
110
|
+
...walletClient ? { walletClient } : {},
|
|
111
|
+
address: opts.address,
|
|
112
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
113
|
+
...telemetry ? { telemetry } : {}
|
|
114
|
+
});
|
|
115
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
116
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
117
|
+
}
|
|
118
|
+
function useMemoMerkleAirdropClient(opts) {
|
|
119
|
+
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
120
|
+
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
121
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
122
|
+
const telemetry = opts.telemetry;
|
|
123
|
+
const client = react.useMemo(() => {
|
|
124
|
+
if (!publicClient) return void 0;
|
|
125
|
+
if (!opts.address) return void 0;
|
|
126
|
+
return chunkPZZK3O3S_cjs.createMerkleAirdropClient({
|
|
127
|
+
publicClient,
|
|
128
|
+
...walletClient ? { walletClient } : {},
|
|
129
|
+
address: opts.address,
|
|
130
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
131
|
+
...telemetry ? { telemetry } : {}
|
|
132
|
+
});
|
|
133
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
134
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
135
|
+
}
|
|
136
|
+
function useMemoComplianceManagerClient(opts) {
|
|
137
|
+
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
138
|
+
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
139
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
140
|
+
const telemetry = opts.telemetry;
|
|
141
|
+
const client = react.useMemo(() => {
|
|
142
|
+
if (!publicClient) return void 0;
|
|
143
|
+
if (!opts.address) return void 0;
|
|
144
|
+
return chunkPZZK3O3S_cjs.createComplianceManagerClient({
|
|
145
|
+
publicClient,
|
|
146
|
+
...walletClient ? { walletClient } : {},
|
|
147
|
+
address: opts.address,
|
|
148
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
149
|
+
...telemetry ? { telemetry } : {}
|
|
150
|
+
});
|
|
151
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
152
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
153
|
+
}
|
|
154
|
+
function useMemoEcdsaAirdropClient(opts) {
|
|
155
|
+
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
156
|
+
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
157
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
158
|
+
const telemetry = opts.telemetry;
|
|
159
|
+
const client = react.useMemo(() => {
|
|
160
|
+
if (!publicClient) return void 0;
|
|
161
|
+
if (!opts.address) return void 0;
|
|
162
|
+
return chunkPZZK3O3S_cjs.createEcdsaAirdropClient({
|
|
163
|
+
publicClient,
|
|
164
|
+
...walletClient ? { walletClient } : {},
|
|
165
|
+
address: opts.address,
|
|
166
|
+
dedupMode: opts.dedupMode,
|
|
167
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
168
|
+
...telemetry ? { telemetry } : {}
|
|
169
|
+
});
|
|
170
|
+
}, [publicClient, walletClient, opts.address, opts.dedupMode, chainId, telemetry]);
|
|
171
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/fhe-airdrop/react/keys.ts
|
|
175
|
+
var AIRDROP_FN = {
|
|
176
|
+
// instance reads
|
|
177
|
+
claimedAmount: "getClaimedAmount",
|
|
178
|
+
paused: "paused",
|
|
179
|
+
window: "window",
|
|
180
|
+
config: "config",
|
|
181
|
+
merkleRoot: "merkleRoot",
|
|
182
|
+
merkleRootMutable: "isMerkleRootMutable",
|
|
183
|
+
hasRole: "hasRole",
|
|
184
|
+
roleMembers: "roleMembers",
|
|
185
|
+
gasFee: "gasFee",
|
|
186
|
+
preflightCreate: "preflightCreate",
|
|
187
|
+
isSignatureValid: "isSignatureValid",
|
|
188
|
+
// factory reads
|
|
189
|
+
fees: "fees",
|
|
190
|
+
registry: "registry",
|
|
191
|
+
customFee: "customFee",
|
|
192
|
+
implementations: "implementations",
|
|
193
|
+
compliancePolicy: "compliancePolicy",
|
|
194
|
+
upgradeabilityPolicy: "upgradeabilityPolicy",
|
|
195
|
+
factoryHasRole: "factoryHasRole",
|
|
196
|
+
factoryRoleMembers: "factoryRoleMembers",
|
|
197
|
+
// compliance-manager reads
|
|
198
|
+
complianceInfo: "complianceInfo",
|
|
199
|
+
activeDelegate: "isActiveDelegate",
|
|
200
|
+
clientDelegates: "clientDelegates",
|
|
201
|
+
complianceHasRole: "complianceHasRole",
|
|
202
|
+
complianceRoleMembers: "complianceRoleMembers"
|
|
203
|
+
};
|
|
204
|
+
var airdropKeys = {
|
|
205
|
+
/** One account's cumulative delivered total. Keyed on the CLAIM IDENTITY, never the sender. */
|
|
206
|
+
claimedAmount: (s, account) => airdropQueryKey({ ...s, fn: AIRDROP_FN.claimedAmount, args: [account] }),
|
|
207
|
+
paused: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.paused, args: [] }),
|
|
208
|
+
window: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.window, args: [] }),
|
|
209
|
+
config: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.config, args: [] }),
|
|
210
|
+
gasFee: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.gasFee, args: [] }),
|
|
211
|
+
merkleRoot: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.merkleRoot, args: [] }),
|
|
212
|
+
merkleRootMutable: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.merkleRootMutable, args: [] }),
|
|
213
|
+
hasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.hasRole, args: [role, holder] }),
|
|
214
|
+
/** Every cached `hasRole` for this instance, whatever role/holder pair was queried. */
|
|
215
|
+
hasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.hasRole }),
|
|
216
|
+
roleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.roleMembers, args: [role] }),
|
|
217
|
+
roleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.roleMembers }),
|
|
218
|
+
/** Every cached create-preflight, whatever params/mode/salt combination was queried. */
|
|
219
|
+
preflightCreateAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.preflightCreate }),
|
|
220
|
+
/** Every cached signature check on this instance; a claim consumes a digest and flips it. */
|
|
221
|
+
isSignatureValidAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.isSignatureValid }),
|
|
222
|
+
fees: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.fees, args: [] }),
|
|
223
|
+
customFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.customFee, args: [creator] }),
|
|
224
|
+
customFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.customFee }),
|
|
225
|
+
/** Every registry page, whatever offset/limit was queried. */
|
|
226
|
+
registryAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.registry }),
|
|
227
|
+
implementations: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.implementations, args: [] }),
|
|
228
|
+
compliancePolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.compliancePolicy, args: [creator] }),
|
|
229
|
+
compliancePolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.compliancePolicy }),
|
|
230
|
+
upgradeabilityPolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.upgradeabilityPolicy, args: [creator] }),
|
|
231
|
+
upgradeabilityPolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.upgradeabilityPolicy }),
|
|
232
|
+
factoryHasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.factoryHasRole, args: [role, holder] }),
|
|
233
|
+
factoryHasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.factoryHasRole }),
|
|
234
|
+
factoryRoleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.factoryRoleMembers, args: [role] }),
|
|
235
|
+
factoryRoleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.factoryRoleMembers }),
|
|
236
|
+
complianceInfo: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceInfo, args: [] }),
|
|
237
|
+
activeDelegate: (s, delegate) => airdropQueryKey({ ...s, fn: AIRDROP_FN.activeDelegate, args: [delegate] }),
|
|
238
|
+
activeDelegateAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.activeDelegate }),
|
|
239
|
+
clientDelegates: (s, index) => airdropQueryKey({ ...s, fn: AIRDROP_FN.clientDelegates, args: [index] }),
|
|
240
|
+
clientDelegatesAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.clientDelegates }),
|
|
241
|
+
complianceHasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceHasRole, args: [role, holder] }),
|
|
242
|
+
complianceHasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.complianceHasRole }),
|
|
243
|
+
complianceRoleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceRoleMembers, args: [role] }),
|
|
244
|
+
complianceRoleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.complianceRoleMembers })
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
exports.AIRDROP_FN = AIRDROP_FN;
|
|
248
|
+
exports.airdropKeys = airdropKeys;
|
|
249
|
+
exports.airdropQueryKey = airdropQueryKey;
|
|
250
|
+
exports.airdropQueryKeyPrefix = airdropQueryKeyPrefix;
|
|
251
|
+
exports.useMemoAirdropBaseClient = useMemoAirdropBaseClient;
|
|
252
|
+
exports.useMemoAirdropFactoryClient = useMemoAirdropFactoryClient;
|
|
253
|
+
exports.useMemoComplianceManagerClient = useMemoComplianceManagerClient;
|
|
254
|
+
exports.useMemoEcdsaAirdropClient = useMemoEcdsaAirdropClient;
|
|
255
|
+
exports.useMemoMerkleAirdropClient = useMemoMerkleAirdropClient;
|