@tokenops/sdk 2.0.0-alpha.3 → 2.0.0-alpha.4

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.
Files changed (151) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +71 -35
  3. package/SUPPORT.md +1 -1
  4. package/dist/{chunk-NGU4JYIR.js → chunk-2ND7US2I.js} +1 -1
  5. package/dist/{chunk-U3TBQRT7.js → chunk-3ZSPRHR3.js} +55 -12
  6. package/dist/{chunk-BXX5TETM.js → chunk-67Q6KSVV.js} +4114 -3267
  7. package/dist/{chunk-JVNJSDQ4.cjs → chunk-6AYJRUGP.cjs} +7 -50
  8. package/dist/{chunk-AHU2HMNE.cjs → chunk-6FUHF73F.cjs} +5 -5
  9. package/dist/{chunk-NWFMBLSQ.js → chunk-7KY4K4PH.js} +1 -1
  10. package/dist/{chunk-YABHXJNH.cjs → chunk-ARZ5C3FS.cjs} +7 -7
  11. package/dist/{chunk-4IB4IY5Y.js → chunk-AX6MQAWU.js} +2 -2
  12. package/dist/{chunk-BPIVVCSQ.js → chunk-BSXEX2SH.js} +3 -3
  13. package/dist/{chunk-PK6Q6J5F.js → chunk-CHGY6B7L.js} +34 -81
  14. package/dist/{chunk-GKYZQJGP.cjs → chunk-DFK5GCJP.cjs} +55 -72
  15. package/dist/{chunk-4AWQJQXY.cjs → chunk-E4IV4M4E.cjs} +4126 -3279
  16. package/dist/{chunk-6HCT4QIX.js → chunk-GHGF65LN.js} +16 -13
  17. package/dist/{chunk-TWT3STIX.js → chunk-K3R27WX4.js} +8 -46
  18. package/dist/{chunk-GCJFAY4X.js → chunk-KJUNBOJQ.js} +52 -71
  19. package/dist/{chunk-6XOAYDC6.cjs → chunk-PO3A2AQX.cjs} +4 -4
  20. package/dist/{chunk-TND5NDV7.cjs → chunk-QHDMPT7I.cjs} +64 -19
  21. package/dist/{chunk-IEKTGJ4J.cjs → chunk-S47IBDTA.cjs} +36 -83
  22. package/dist/{chunk-UG5RKLU2.cjs → chunk-SUYBAF27.cjs} +1 -1
  23. package/dist/{chunk-WRWRA4TN.js → chunk-TWU7L5H7.js} +5 -48
  24. package/dist/{chunk-WJLECC22.cjs → chunk-UUSSWOPR.cjs} +9 -47
  25. package/dist/{chunk-YTIYTV4K.cjs → chunk-VHKMWWBA.cjs} +319 -40
  26. package/dist/{chunk-PG3WXT3K.cjs → chunk-YAL6JSAZ.cjs} +16 -13
  27. package/dist/{chunk-LEYYG4RF.js → chunk-YMWMIWBP.js} +315 -42
  28. package/dist/core/addresses.d.ts +4 -4
  29. package/dist/core/errors.d.ts +1 -1
  30. package/dist/core/index.d.ts +1 -0
  31. package/dist/core/pending.d.ts +57 -0
  32. package/dist/core/version.d.ts +1 -1
  33. package/dist/fhe/operators.d.ts +6 -5
  34. package/dist/fhe/types.d.ts +1 -1
  35. package/dist/fhe-airdrop/abis/airdrop-base.d.ts +81 -4
  36. package/dist/fhe-airdrop/abis/ecdsa.d.ts +101 -4
  37. package/dist/fhe-airdrop/abis/factory.d.ts +222 -4
  38. package/dist/fhe-airdrop/abis/merkle.d.ts +100 -4
  39. package/dist/fhe-airdrop/advanced/index.cjs +8 -4
  40. package/dist/fhe-airdrop/advanced/index.d.cts +1 -0
  41. package/dist/fhe-airdrop/advanced/index.d.ts +1 -0
  42. package/dist/fhe-airdrop/advanced/index.js +1 -1
  43. package/dist/fhe-airdrop/advanced/react/index.cjs +121 -143
  44. package/dist/fhe-airdrop/advanced/react/index.js +55 -77
  45. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +3 -1
  46. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +3 -1
  47. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +2 -4
  48. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +7 -7
  49. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +3 -1
  50. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +2 -1
  51. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +3 -1
  52. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +5 -4
  53. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +3 -1
  54. package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +7 -3
  55. package/dist/fhe-airdrop/airdrop-base.d.ts +95 -10
  56. package/dist/fhe-airdrop/campaign.d.ts +37 -73
  57. package/dist/fhe-airdrop/compliance-clone.d.ts +21 -0
  58. package/dist/fhe-airdrop/constants.d.ts +3 -1
  59. package/dist/fhe-airdrop/ecdsa.d.ts +67 -27
  60. package/dist/fhe-airdrop/encryption.d.ts +19 -6
  61. package/dist/fhe-airdrop/errors.d.ts +77 -2
  62. package/dist/fhe-airdrop/factory-params.d.ts +2361 -0
  63. package/dist/fhe-airdrop/factory.d.ts +142 -68
  64. package/dist/fhe-airdrop/guards.d.ts +110 -31
  65. package/dist/fhe-airdrop/index.cjs +79 -59
  66. package/dist/fhe-airdrop/index.d.cts +11 -9
  67. package/dist/fhe-airdrop/index.d.ts +11 -9
  68. package/dist/fhe-airdrop/index.js +5 -5
  69. package/dist/fhe-airdrop/merkle-tree.d.ts +9 -9
  70. package/dist/fhe-airdrop/merkle.d.ts +32 -11
  71. package/dist/fhe-airdrop/react/_shared.d.ts +12 -6
  72. package/dist/fhe-airdrop/react/index.cjs +294 -258
  73. package/dist/fhe-airdrop/react/index.d.cts +16 -9
  74. package/dist/fhe-airdrop/react/index.d.ts +16 -9
  75. package/dist/fhe-airdrop/react/index.js +114 -110
  76. package/dist/fhe-airdrop/react/keys.d.ts +46 -7
  77. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +6 -3
  78. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +2 -2
  79. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +8 -3
  80. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +5 -0
  81. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +4 -6
  82. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +2 -2
  83. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +1 -2
  84. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +16 -11
  85. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +23 -7
  86. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +13 -8
  87. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +27 -7
  88. package/dist/fhe-airdrop/react/useDedupMode.d.ts +16 -0
  89. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +4 -3
  90. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +6 -4
  91. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +15 -8
  92. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +1 -1
  93. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +5 -7
  94. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +4 -1
  95. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +3 -4
  96. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +2 -1
  97. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +5 -4
  98. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +4 -1
  99. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +14 -3
  100. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +18 -3
  101. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +1 -1
  102. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +34 -13
  103. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +3 -3
  104. package/dist/fhe-airdrop/react/useRescueNativeToken.d.ts +23 -0
  105. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +5 -2
  106. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +4 -0
  107. package/dist/fhe-airdrop/react/useTokenOf.d.ts +29 -0
  108. package/dist/fhe-airdrop/react/useUnwrapRequest.d.ts +25 -0
  109. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +4 -0
  110. package/dist/fhe-airdrop/roles.d.ts +82 -7
  111. package/dist/fhe-airdrop/types.d.ts +109 -14
  112. package/dist/fhe-disperse/errors.d.ts +3 -3
  113. package/dist/fhe-disperse/index.cjs +22 -22
  114. package/dist/fhe-disperse/index.d.cts +2 -1
  115. package/dist/fhe-disperse/index.d.ts +2 -1
  116. package/dist/fhe-disperse/index.js +3 -3
  117. package/dist/fhe-disperse/react/index.cjs +27 -25
  118. package/dist/fhe-disperse/react/index.d.cts +2 -1
  119. package/dist/fhe-disperse/react/index.d.ts +2 -1
  120. package/dist/fhe-disperse/react/index.js +8 -6
  121. package/dist/fhe-disperse/react/useDisperse.d.ts +6 -2
  122. package/dist/fhe-disperse/react/useRegister.d.ts +9 -3
  123. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +7 -2
  124. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +7 -2
  125. package/dist/fhe-disperse/singleton.d.ts +33 -19
  126. package/dist/fhe-disperse/types.d.ts +48 -8
  127. package/dist/fhe-vesting/advanced/index.cjs +6 -6
  128. package/dist/fhe-vesting/advanced/index.js +4 -4
  129. package/dist/fhe-vesting/advanced/react/index.cjs +9 -9
  130. package/dist/fhe-vesting/advanced/react/index.js +6 -6
  131. package/dist/fhe-vesting/factory.d.ts +31 -8
  132. package/dist/fhe-vesting/index.cjs +23 -23
  133. package/dist/fhe-vesting/index.d.cts +3 -2
  134. package/dist/fhe-vesting/index.d.ts +3 -2
  135. package/dist/fhe-vesting/index.js +4 -4
  136. package/dist/fhe-vesting/manager.d.ts +27 -2
  137. package/dist/fhe-vesting/react/index.cjs +126 -126
  138. package/dist/fhe-vesting/react/index.d.cts +3 -2
  139. package/dist/fhe-vesting/react/index.d.ts +3 -2
  140. package/dist/fhe-vesting/react/index.js +5 -5
  141. package/dist/fhe-vesting/react/useCreateManager.d.ts +16 -9
  142. package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +9 -5
  143. package/dist/fhe-vesting/react/useSplitVesting.d.ts +9 -3
  144. package/dist/index.cjs +18 -18
  145. package/dist/index.js +1 -1
  146. package/dist/testnet-faucet/faucet.d.ts +3 -0
  147. package/dist/testnet-faucet/index.cjs +15 -15
  148. package/dist/testnet-faucet/index.js +3 -3
  149. package/dist/testnet-faucet/react/index.cjs +9 -9
  150. package/dist/testnet-faucet/react/index.js +4 -4
  151. package/package.json +1 -1
@@ -2,9 +2,9 @@
2
2
 
3
3
  var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
4
4
  var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
5
- var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
5
+ var chunkSUYBAF27_cjs = require('./chunk-SUYBAF27.cjs');
6
6
  var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
7
- var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.cjs');
7
+ var chunkYAL6JSAZ_cjs = require('./chunk-YAL6JSAZ.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 : chunkPG3WXT3K_cjs.getFheDisperseSingletonAddress(chainId));
2055
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkYAL6JSAZ_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",
@@ -2069,7 +2069,7 @@ var ConfidentialDisperseClient = class {
2069
2069
  chainId: chainId ?? null,
2070
2070
  hasWallet: !!this.walletClient,
2071
2071
  aclResolved: !!config.aclAddress || chainId !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainId),
2072
- sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
2072
+ sdkVersion: chunkSUYBAF27_cjs.SDK_VERSION
2073
2073
  });
2074
2074
  }
2075
2075
  /**
@@ -2274,7 +2274,8 @@ var ConfidentialDisperseClient = class {
2274
2274
  *
2275
2275
  * Internally composes:
2276
2276
  * - `isRegistered` + `getWallets` / `predictWallets`
2277
- * - `hasApprovedSubwallets` (wallet modes) or `isOperator(sender, singleton)` (direct mode)
2277
+ * - `isOperator(sender, singleton)` (every mode: each one pulls from the sender) and,
2278
+ * for the wallet modes, `hasApprovedSubwallets` as well
2278
2279
  * - `calculateFee` / `getBatchLimits`
2279
2280
  * - Structural recipient + amount validation
2280
2281
  *
@@ -2289,12 +2290,25 @@ var ConfidentialDisperseClient = class {
2289
2290
  const { user, token, recipients, amounts, mode } = args;
2290
2291
  assertChecksumAddress(user, "user", "preflightDisperse");
2291
2292
  assertChecksumAddress(token, "token", "preflightDisperse");
2292
- const [isUserRegistered, predictedWallets, batchLimits, callerBalance, isPaused] = await Promise.all([
2293
+ const [
2294
+ isUserRegistered,
2295
+ predictedWallets,
2296
+ batchLimits,
2297
+ callerBalance,
2298
+ isPaused,
2299
+ hasApprovedSingleton
2300
+ ] = await Promise.all([
2293
2301
  this.isRegistered(user),
2294
2302
  this.predictWallets(user),
2295
2303
  this.getBatchLimits(),
2296
2304
  this.publicClient.getBalance({ address: user }),
2297
- this.paused()
2305
+ this.paused(),
2306
+ this.publicClient.readContract({
2307
+ address: token,
2308
+ abi: ERC7984_IS_OPERATOR_ABI,
2309
+ functionName: "isOperator",
2310
+ args: [user, this.address]
2311
+ })
2298
2312
  ]);
2299
2313
  const wallets = isUserRegistered ? await this.getWallets(user) : null;
2300
2314
  let hasApprovedSubwallets = {
@@ -2302,15 +2316,7 @@ var ConfidentialDisperseClient = class {
2302
2316
  wallet1: false,
2303
2317
  both: false
2304
2318
  };
2305
- let hasApprovedSingleton = null;
2306
- if (mode === "direct") {
2307
- hasApprovedSingleton = await this.publicClient.readContract({
2308
- address: token,
2309
- abi: ERC7984_IS_OPERATOR_ABI,
2310
- functionName: "isOperator",
2311
- args: [user, this.address]
2312
- });
2313
- } else {
2319
+ if (mode !== "direct") {
2314
2320
  if (isUserRegistered) {
2315
2321
  hasApprovedSubwallets = await this.hasApprovedSubwallets({ user, token });
2316
2322
  } else if (predictedWallets) {
@@ -2392,7 +2398,7 @@ var ConfidentialDisperseClient = class {
2392
2398
  );
2393
2399
  }
2394
2400
  }
2395
- if (mode === "direct" && hasApprovedSingleton === false) {
2401
+ if (!hasApprovedSingleton) {
2396
2402
  blockers.push("Sender has not approved the singleton as operator on the token");
2397
2403
  blockerErrors.push(
2398
2404
  new SingletonNotApprovedError({
@@ -2441,18 +2447,6 @@ var ConfidentialDisperseClient = class {
2441
2447
  blockerErrors
2442
2448
  };
2443
2449
  }
2444
- // ============================================================
2445
- // WRITE METHODS
2446
- // ============================================================
2447
- /**
2448
- * Register the caller's dedicated wallet pair for wallet-mode disperses.
2449
- *
2450
- * Deploys two deterministic ERC-1167 wallet clones and approves them for `token`.
2451
- * Can only be called once per user — subsequent calls revert with `UserAlreadyRegistered`.
2452
- *
2453
- * @returns `{ hash, wallets }` — `wallets` is parsed from the `UserRegistered` event.
2454
- * @throws {DisperseSubwalletNotFoundError} if no `UserRegistered` event matching the singleton is found.
2455
- */
2456
2450
  async register(args) {
2457
2451
  return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-disperse.singleton.register", async () => {
2458
2452
  assertChecksumAddress(args.token, "token", "register");
@@ -2475,6 +2469,9 @@ var ConfidentialDisperseClient = class {
2475
2469
  } catch (err) {
2476
2470
  throw this.#mapRevert("register", err, { user: userAddress }, userAddress);
2477
2471
  }
2472
+ if (args.waitForReceipt === false) {
2473
+ return { hash, wallets: void 0, pending: true };
2474
+ }
2478
2475
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2479
2476
  const events = viem.parseEventLogs({
2480
2477
  abi: disperseConfidentialAbi,
@@ -2534,32 +2531,6 @@ var ConfidentialDisperseClient = class {
2534
2531
  const user = this.#userAddressFromOverride(args.account, "recoverERC20FromWallets");
2535
2532
  return this.#write("recoverERC20FromWallets", [args.token, args.to], args.account, { user });
2536
2533
  }
2537
- /**
2538
- * Disperse confidential tokens to multiple recipients.
2539
- *
2540
- * SDK responsibilities:
2541
- * 1. Validates input deterministically (lengths, zero addresses, per-amount
2542
- * uint64 bounds, wallet-mode subtotal overflow, batch-limit for the
2543
- * selected mode) — using the same {@link validateDisperseInputs} helper
2544
- * `preflightDisperse` uses, so an oversized or malformed batch is rejected
2545
- * before any FHE encryption time is spent.
2546
- * 2. For wallet modes: computes group subtotals using the contract's exact split rule.
2547
- * 3. Encrypts amounts + subtotals in a single batch call (one input proof).
2548
- * 4. Computes `msg.value` for gas-fee modes; `0` for token-fee mode.
2549
- * 5. Dispatches to the correct contract function based on `mode`.
2550
- *
2551
- * **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
2552
- *
2553
- * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2554
- * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2555
- * ERC-20. Amount parameters are base units of the token's actual decimals:
2556
- * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2557
- * transparent TTT test token uses 18 decimals. Every entry of `amounts[]`
2558
- * follows this convention.
2559
- *
2560
- * @throws {TokenOpsSdkError} on input validation failure (first deterministic error).
2561
- * @throws {TokenOpsSdkError} if no encryptor is available at call time.
2562
- */
2563
2534
  async disperse(args) {
2564
2535
  return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-disperse.singleton.disperse", async () => {
2565
2536
  const { token, mode, recipients, amounts } = args;
@@ -2592,7 +2563,8 @@ var ConfidentialDisperseClient = class {
2592
2563
  wallet,
2593
2564
  userAddr,
2594
2565
  enc,
2595
- gasFeeOverride: args.gasFeeOverride
2566
+ gasFeeOverride: args.gasFeeOverride,
2567
+ waitForReceipt: args.waitForReceipt
2596
2568
  });
2597
2569
  }
2598
2570
  return this.#disperseWallet({
@@ -2604,7 +2576,8 @@ var ConfidentialDisperseClient = class {
2604
2576
  wallet,
2605
2577
  userAddr,
2606
2578
  enc,
2607
- gasFeeOverride: args.gasFeeOverride
2579
+ gasFeeOverride: args.gasFeeOverride,
2580
+ waitForReceipt: args.waitForReceipt
2608
2581
  });
2609
2582
  });
2610
2583
  }
@@ -2865,32 +2838,6 @@ var ConfidentialDisperseClient = class {
2865
2838
  assertNonZeroChecksumAddress(to, "to", "withdrawGasFee");
2866
2839
  return this.#write("withdrawGasFee", [to, amount], account);
2867
2840
  }
2868
- /**
2869
- * Withdraw accumulated encrypted token fees.
2870
- *
2871
- * The amount is encrypted by the caller — pass plaintext `amount` and an
2872
- * encryptor, or pass `encryptedInput` directly. The contract caps the
2873
- * withdrawal at the available reserve via `FHE.min`.
2874
- *
2875
- * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2876
- * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2877
- * ERC-20. Amount parameters are base units of the token's actual decimals:
2878
- * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2879
- * transparent TTT test token uses 18 decimals.
2880
- *
2881
- * Returns the tx hash plus the **transferred** handle parsed from the
2882
- * `TokenFeeWithdrawn` event. Decrypt the handle via Zama's `userDecrypt`
2883
- * to view the actual amount moved (which can be less than requested when
2884
- * the reserve was smaller than the request). The caller is granted
2885
- * persistent ACL on this handle by the contract.
2886
- *
2887
- * **`encryptedInput` is bound to (this singleton, this caller).** Zama's
2888
- * KMSVerifier rejects proofs whose `contractAddress` or `userAddress`
2889
- * don't match the executing tx. If you pre-encrypt on a different chain's
2890
- * singleton, or for a different caller, the on-chain submission will
2891
- * revert with a generic verification failure. The plaintext `amount`
2892
- * path is safer when the caller / chain isn't fixed yet.
2893
- */
2894
2841
  async withdrawTokenFee(args) {
2895
2842
  assertChecksumAddress(args.token, "token", "withdrawTokenFee");
2896
2843
  assertNonZeroChecksumAddress(args.to, "to", "withdrawTokenFee");
@@ -2922,6 +2869,9 @@ var ConfidentialDisperseClient = class {
2922
2869
  } catch (err) {
2923
2870
  throw this.#mapRevert("withdrawTokenFee", err, void 0, accountAddress(account));
2924
2871
  }
2872
+ if (args.waitForReceipt === false) {
2873
+ return { hash, transferredHandle: void 0, pending: true };
2874
+ }
2925
2875
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2926
2876
  const events = viem.parseEventLogs({
2927
2877
  abi: disperseConfidentialAbi,
@@ -3052,6 +3002,7 @@ var ConfidentialDisperseClient = class {
3052
3002
  } catch (err) {
3053
3003
  throw this.#mapRevert("disperse[direct]", err, { user: userAddr }, userAddr);
3054
3004
  }
3005
+ if (args.waitForReceipt === false) return { hash, distributions: void 0, pending: true };
3055
3006
  const distributions = await this.#parseDirectDistributions(hash);
3056
3007
  return { hash, distributions };
3057
3008
  }
@@ -3102,6 +3053,7 @@ var ConfidentialDisperseClient = class {
3102
3053
  } catch (err) {
3103
3054
  throw this.#mapRevert("disperse[wallet-token-fee]", err, { user: userAddr }, userAddr);
3104
3055
  }
3056
+ if (args.waitForReceipt === false) return { hash: hash2, distributions: void 0, pending: true };
3105
3057
  const distributions2 = await this.#parseWalletDistributions(hash2);
3106
3058
  return { hash: hash2, distributions: distributions2 };
3107
3059
  }
@@ -3139,6 +3091,7 @@ var ConfidentialDisperseClient = class {
3139
3091
  } catch (err) {
3140
3092
  throw this.#mapRevert("disperse[wallet]", err, { user: userAddr }, userAddr);
3141
3093
  }
3094
+ if (args.waitForReceipt === false) return { hash, distributions: void 0, pending: true };
3142
3095
  const distributions = await this.#parseWalletDistributions(hash);
3143
3096
  return { hash, distributions };
3144
3097
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  // src/core/version.ts
4
- var SDK_VERSION = "1.0.0";
4
+ var SDK_VERSION = "2.0.0-alpha.4";
5
5
 
6
6
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,6 +1,6 @@
1
- import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
1
+ import { SDK_VERSION } from './chunk-7KY4K4PH.js';
2
2
  import { mapContractRevert, isContractRevert } from './chunk-4RAAATVY.js';
3
- import { getFheVestingFactoryAddress } from './chunk-6HCT4QIX.js';
3
+ import { getFheVestingFactoryAddress } from './chunk-GHGF65LN.js';
4
4
  import { normaliseAddress } from './chunk-ZA673I3O.js';
5
5
  import { asTxHash } from './chunk-KWFFIJYX.js';
6
6
  import { DeploymentAddressUnavailableError, TokenOpsSdkError, MissingWalletClientError, MissingAccountError } from './chunk-QBJ7O2B4.js';
@@ -465,33 +465,6 @@ var ConfidentialVestingFactoryClient = class {
465
465
  sdkVersion: SDK_VERSION
466
466
  });
467
467
  }
468
- // ----------------------- writes -----------------------
469
- /**
470
- * Deploy a new `ConfidentialVestingManager` clone via the factory and return
471
- * its address, parsed from the `ManagerCreated` event in the tx receipt.
472
- *
473
- * **This is the headline factory entry point.** It returns one rich-return
474
- * shape: the address is only knowable after the tx mines (the factory packs
475
- * `block.number` into the clone's immutable args), so a hash-only variant
476
- * would force consumers to re-derive what the SDK already had to compute.
477
- *
478
- * Calls `createManagerWithOptions` when `splitEnabled` or `pausableEnabled`
479
- * is provided; otherwise calls the simpler `createManager` entry point.
480
- *
481
- * Internally: `writeContract` → {@link PublicClient.waitForTransactionReceipt} →
482
- * `parseEventLogs({ eventName: "ManagerCreated" })`.
483
- *
484
- * Pre-mine prediction is exposed only on
485
- * `ConfidentialVestingFactoryAdvancedClient` from
486
- * `@tokenops/sdk/fhe-vesting/advanced` — predict at block N, mine at N+1,
487
- * the addresses differ.
488
- *
489
- * @example
490
- * const { hash, manager } = await factory.createManager({
491
- * token: "0xYourToken",
492
- * userSalt: "0x0000000000000000000000000000000000000000000000000000000000000001",
493
- * });
494
- */
495
468
  async createManager(args) {
496
469
  return withTelemetry(this.#telemetry, "fhe-vesting.factory.createManager", async () => {
497
470
  const hasOptions = args.splitEnabled !== void 0 || args.pausableEnabled !== void 0;
@@ -500,28 +473,12 @@ var ConfidentialVestingFactoryClient = class {
500
473
  [args.token, args.userSalt, args.splitEnabled ?? true, args.pausableEnabled ?? true],
501
474
  args.account
502
475
  ) : await this.#write("createManager", [args.token, args.userSalt], args.account);
476
+ if (args.waitForReceipt === false) {
477
+ return { hash: asTxHash(hash), manager: void 0, pending: true };
478
+ }
503
479
  return this.#resolveManagerFromReceipt(hash, "createManager");
504
480
  });
505
481
  }
506
- /**
507
- * Deploy a new manager clone and return its address, parsed from the
508
- * `ManagerCreated` event in the tx receipt.
509
- *
510
- * This is the recommended entry point for the common "deploy a clone and use
511
- * its address" flow. {@link ConfidentialVestingFactoryClient.predictManagerAddress}
512
- * is unreliable on a live chain because the factory packs the deployment
513
- * block number into the clone's immutable args — predict at block N, mine at
514
- * N+1, and the addresses differ.
515
- *
516
- * Internally: {@link ConfidentialVestingFactoryClient.createManager} →
517
- * {@link PublicClient.waitForTransactionReceipt} →
518
- * `parseEventLogs({ eventName: "ManagerCreated" })`.
519
- *
520
- * @example
521
- * const { hash, manager } = await factory.createManagerAndGetAddress({
522
- * token, userSalt,
523
- * });
524
- */
525
482
  async createManagerAndGetAddress(args) {
526
483
  return this.createManager(args);
527
484
  }
@@ -4,7 +4,7 @@ var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
4
4
  var chunk3QHNYEQD_cjs = require('./chunk-3QHNYEQD.cjs');
5
5
  var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
6
6
  var chunkFWHYQZ5E_cjs = require('./chunk-FWHYQZ5E.cjs');
7
- var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
7
+ var chunkSUYBAF27_cjs = require('./chunk-SUYBAF27.cjs');
8
8
  var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
9
9
  var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
10
10
  var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
@@ -1192,7 +1192,7 @@ var ConfidentialVestingManagerClient = class {
1192
1192
  chainId: chainIdForInit ?? null,
1193
1193
  hasWallet: !!this.walletClient,
1194
1194
  aclResolved: !!config.aclAddress || chainIdForInit !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainIdForInit),
1195
- sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
1195
+ sdkVersion: chunkSUYBAF27_cjs.SDK_VERSION
1196
1196
  });
1197
1197
  }
1198
1198
  /**
@@ -1652,6 +1652,8 @@ var ConfidentialVestingManagerClient = class {
1652
1652
  * {@link OperatorNotApprovedError} (the SDK's mapping of the on-chain
1653
1653
  * `ERC7984UnauthorizedSpender` revert, whose message is the canonical
1654
1654
  * `OPERATOR_NOT_APPROVED_REMEDIATION` copy).
1655
+ * Both helpers wait for their receipt by default; a Safe / multisig signer
1656
+ * passes `waitForReceipt: false` to them.
1655
1657
  *
1656
1658
  * @returns Transaction hash. Parse the `VestingCreated` event to extract the `vestingId`.
1657
1659
  * @example
@@ -1708,6 +1710,8 @@ var ConfidentialVestingManagerClient = class {
1708
1710
  * {@link OperatorNotApprovedError} (the SDK's mapping of the on-chain
1709
1711
  * `ERC7984UnauthorizedSpender` revert, whose message is the canonical
1710
1712
  * `OPERATOR_NOT_APPROVED_REMEDIATION` copy).
1713
+ * Both helpers wait for their receipt by default; a Safe / multisig signer
1714
+ * passes `waitForReceipt: false` to them.
1711
1715
  *
1712
1716
  * @returns Transaction hash.
1713
1717
  */
@@ -1931,51 +1935,6 @@ var ConfidentialVestingManagerClient = class {
1931
1935
  }
1932
1936
  return this.#simpleWrite("batchRevokeVesting", [vestingIds], account);
1933
1937
  }
1934
- /**
1935
- * Split a vesting into two positions.
1936
- *
1937
- * The `numerator/denominator` ratio is auto-scaled via `scaleRatio` to the
1938
- * universal split constant `FHE_SPLIT_DENOMINATOR` (`90_090_000` =
1939
- * LCM(1..16, 10_000)) unless `args.preScaled` is set. Every confidential
1940
- * split lands on the same plaintext denominator so the constant itself
1941
- * leaks no information about the split's shape; only the encrypted
1942
- * numerator carries the share. `90_090_000` is well above the contract's
1943
- * `MIN_SPLIT_DENOMINATOR` (10_000) floor. The SDK encrypts `numerator` —
1944
- * pass plaintext.
1945
- *
1946
- * Two natural input shapes both produce exact integer numerators against
1947
- * the universal denominator:
1948
- * - `n/m` with `m ∈ 1..16` (halves, thirds, …, sixteenths)
1949
- * - `bps/10_000` (basis points)
1950
- *
1951
- * Use the {@link share} builder to construct them without manual math:
1952
- * `share.fraction(1, 7)` or `share.basisPoints(250)` → pass the returned
1953
- * `{ numerator, denominator }` with `preScaled: true`.
1954
- *
1955
- * @param args.numerator Plaintext share numerator (kept confidential on-chain).
1956
- * @param args.denominator Plaintext denominator — auto-scaled to 90_090_000.
1957
- * @param args.newRecipient Recipient address for the split-off position.
1958
- * @returns `{ hash, newVestingId }` — the receipt-derived id of the
1959
- * newly-created vesting position, required for any follow-up call
1960
- * (claim, transfer, disclose) on the split-off position.
1961
- * @example
1962
- * const { newVestingId } = await manager.splitVesting({
1963
- * vestingId,
1964
- * numerator: 1n, denominator: 2n, // 50% split; SDK scales to 45_045_000 / 90_090_000
1965
- * newRecipient: "0xNewRecipient",
1966
- * });
1967
- *
1968
- * @example
1969
- * // Basis-point style via the guided builder:
1970
- * const ratio = share.basisPoints(250); // 2.5%
1971
- * const { newVestingId } = await manager.splitVesting({
1972
- * vestingId,
1973
- * numerator: ratio.numerator,
1974
- * denominator: ratio.denominator,
1975
- * preScaled: true,
1976
- * newRecipient: "0xNewRecipient",
1977
- * });
1978
- */
1979
1938
  async splitVesting(args) {
1980
1939
  const wallet = this.#requireWallet("splitVesting");
1981
1940
  const account = this.#resolveAccount(wallet, args.account, "splitVesting");
@@ -2028,6 +1987,9 @@ var ConfidentialVestingManagerClient = class {
2028
1987
  accountAddress(account)
2029
1988
  );
2030
1989
  }
1990
+ if (args.waitForReceipt === false) {
1991
+ return { hash, newVestingId: void 0, pending: true };
1992
+ }
2031
1993
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2032
1994
  const ours = receipt.logs.filter(
2033
1995
  (log) => log.address.toLowerCase() === this.address.toLowerCase()