@tokenops/sdk 2.0.0-alpha.2 → 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 (160) hide show
  1. package/CHANGELOG.md +92 -3
  2. package/README.md +76 -34
  3. package/SUPPORT.md +1 -1
  4. package/dist/{chunk-PYYSB5ZN.js → chunk-2ND7US2I.js} +1 -1
  5. package/dist/{chunk-EYDA6Q6C.js → chunk-3ZSPRHR3.js} +63 -12
  6. package/dist/{chunk-X7WBPCEU.js → chunk-67Q6KSVV.js} +4578 -3383
  7. package/dist/{chunk-UHHMVBLU.cjs → chunk-6AYJRUGP.cjs} +7 -50
  8. package/dist/{chunk-FEDX7B6T.cjs → chunk-6FUHF73F.cjs} +5 -5
  9. package/dist/{chunk-NWFMBLSQ.js → chunk-7KY4K4PH.js} +1 -1
  10. package/dist/{chunk-FHWSBGWE.cjs → chunk-ARZ5C3FS.cjs} +7 -7
  11. package/dist/{chunk-SPLNGUFF.js → chunk-AX6MQAWU.js} +2 -2
  12. package/dist/{chunk-IGO5XSPS.js → chunk-BSXEX2SH.js} +3 -3
  13. package/dist/{chunk-44YJPMQC.js → chunk-CHGY6B7L.js} +34 -81
  14. package/dist/{chunk-IUKKNJ2R.cjs → chunk-DFK5GCJP.cjs} +55 -72
  15. package/dist/{chunk-PZZK3O3S.cjs → chunk-E4IV4M4E.cjs} +4598 -3403
  16. package/dist/{chunk-A4DCEE33.js → chunk-GHGF65LN.js} +16 -12
  17. package/dist/{chunk-TWT3STIX.js → chunk-K3R27WX4.js} +8 -46
  18. package/dist/{chunk-GADGBQJO.js → chunk-KJUNBOJQ.js} +52 -71
  19. package/dist/{chunk-MM5BV5CS.cjs → chunk-PO3A2AQX.cjs} +4 -4
  20. package/dist/{chunk-EBLBPUPI.cjs → chunk-QHDMPT7I.cjs} +72 -19
  21. package/dist/{chunk-3YHBO2DL.cjs → chunk-S47IBDTA.cjs} +36 -83
  22. package/dist/{chunk-UG5RKLU2.cjs → chunk-SUYBAF27.cjs} +1 -1
  23. package/dist/{chunk-WJMEBBU7.js → chunk-TWU7L5H7.js} +5 -48
  24. package/dist/{chunk-WJLECC22.cjs → chunk-UUSSWOPR.cjs} +9 -47
  25. package/dist/{chunk-AREQJHKA.cjs → chunk-VHKMWWBA.cjs} +428 -22
  26. package/dist/{chunk-FT5H2Q7Y.cjs → chunk-YAL6JSAZ.cjs} +16 -12
  27. package/dist/{chunk-VW356KR3.js → chunk-YMWMIWBP.js} +421 -25
  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 +97 -1
  36. package/dist/fhe-airdrop/abis/ecdsa.d.ts +117 -1
  37. package/dist/fhe-airdrop/abis/factory.d.ts +332 -1
  38. package/dist/fhe-airdrop/abis/merkle.d.ts +116 -1
  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 +145 -137
  44. package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -0
  45. package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -0
  46. package/dist/fhe-airdrop/advanced/react/index.js +85 -78
  47. package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +3 -1
  48. package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +4 -1
  49. package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +2 -4
  50. package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +4 -3
  51. package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +9 -7
  52. package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +6 -5
  53. package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +7 -7
  54. package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +3 -1
  55. package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +2 -1
  56. package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +4 -1
  57. package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +5 -4
  58. package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +7 -3
  59. package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +37 -0
  60. package/dist/fhe-airdrop/airdrop-base.d.ts +142 -18
  61. package/dist/fhe-airdrop/campaign.d.ts +37 -73
  62. package/dist/fhe-airdrop/compliance-clone.d.ts +21 -0
  63. package/dist/fhe-airdrop/constants.d.ts +11 -1
  64. package/dist/fhe-airdrop/ecdsa.d.ts +79 -26
  65. package/dist/fhe-airdrop/encryption.d.ts +19 -6
  66. package/dist/fhe-airdrop/errors.d.ts +136 -2
  67. package/dist/fhe-airdrop/factory-params.d.ts +2361 -0
  68. package/dist/fhe-airdrop/factory.d.ts +189 -75
  69. package/dist/fhe-airdrop/guards.d.ts +183 -19
  70. package/dist/fhe-airdrop/index.cjs +88 -56
  71. package/dist/fhe-airdrop/index.d.cts +12 -10
  72. package/dist/fhe-airdrop/index.d.ts +12 -10
  73. package/dist/fhe-airdrop/index.js +5 -5
  74. package/dist/fhe-airdrop/merkle-tree.d.ts +9 -9
  75. package/dist/fhe-airdrop/merkle.d.ts +32 -11
  76. package/dist/fhe-airdrop/react/_shared.d.ts +12 -6
  77. package/dist/fhe-airdrop/react/index.cjs +336 -240
  78. package/dist/fhe-airdrop/react/index.d.cts +19 -9
  79. package/dist/fhe-airdrop/react/index.d.ts +19 -9
  80. package/dist/fhe-airdrop/react/index.js +158 -97
  81. package/dist/fhe-airdrop/react/keys.d.ts +54 -7
  82. package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +6 -3
  83. package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +2 -2
  84. package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +8 -3
  85. package/dist/fhe-airdrop/react/useAirdropPause.d.ts +5 -0
  86. package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +4 -6
  87. package/dist/fhe-airdrop/react/useComplianceManager.d.ts +2 -2
  88. package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +1 -2
  89. package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +16 -11
  90. package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +23 -7
  91. package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +13 -8
  92. package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +27 -7
  93. package/dist/fhe-airdrop/react/useDedupMode.d.ts +16 -0
  94. package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +4 -3
  95. package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +6 -4
  96. package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +15 -8
  97. package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +1 -1
  98. package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +5 -7
  99. package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +4 -1
  100. package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
  101. package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +3 -4
  102. package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +2 -1
  103. package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
  104. package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +5 -4
  105. package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +4 -1
  106. package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +14 -3
  107. package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +18 -3
  108. package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +1 -1
  109. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +34 -13
  110. package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
  111. package/dist/fhe-airdrop/react/useRescueERC20.d.ts +3 -3
  112. package/dist/fhe-airdrop/react/useRescueNativeToken.d.ts +23 -0
  113. package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
  114. package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +5 -2
  115. package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +4 -0
  116. package/dist/fhe-airdrop/react/useTokenOf.d.ts +29 -0
  117. package/dist/fhe-airdrop/react/useUnwrapRequest.d.ts +25 -0
  118. package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +4 -0
  119. package/dist/fhe-airdrop/roles.d.ts +82 -7
  120. package/dist/fhe-airdrop/types.d.ts +122 -14
  121. package/dist/fhe-disperse/errors.d.ts +3 -3
  122. package/dist/fhe-disperse/index.cjs +22 -22
  123. package/dist/fhe-disperse/index.d.cts +2 -1
  124. package/dist/fhe-disperse/index.d.ts +2 -1
  125. package/dist/fhe-disperse/index.js +3 -3
  126. package/dist/fhe-disperse/react/index.cjs +27 -25
  127. package/dist/fhe-disperse/react/index.d.cts +2 -1
  128. package/dist/fhe-disperse/react/index.d.ts +2 -1
  129. package/dist/fhe-disperse/react/index.js +8 -6
  130. package/dist/fhe-disperse/react/useDisperse.d.ts +6 -2
  131. package/dist/fhe-disperse/react/useRegister.d.ts +9 -3
  132. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +7 -2
  133. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +7 -2
  134. package/dist/fhe-disperse/singleton.d.ts +33 -19
  135. package/dist/fhe-disperse/types.d.ts +48 -8
  136. package/dist/fhe-vesting/advanced/index.cjs +6 -6
  137. package/dist/fhe-vesting/advanced/index.js +4 -4
  138. package/dist/fhe-vesting/advanced/react/index.cjs +9 -9
  139. package/dist/fhe-vesting/advanced/react/index.js +6 -6
  140. package/dist/fhe-vesting/factory.d.ts +31 -8
  141. package/dist/fhe-vesting/index.cjs +23 -23
  142. package/dist/fhe-vesting/index.d.cts +3 -2
  143. package/dist/fhe-vesting/index.d.ts +3 -2
  144. package/dist/fhe-vesting/index.js +4 -4
  145. package/dist/fhe-vesting/manager.d.ts +27 -2
  146. package/dist/fhe-vesting/react/index.cjs +126 -126
  147. package/dist/fhe-vesting/react/index.d.cts +3 -2
  148. package/dist/fhe-vesting/react/index.d.ts +3 -2
  149. package/dist/fhe-vesting/react/index.js +5 -5
  150. package/dist/fhe-vesting/react/useCreateManager.d.ts +16 -9
  151. package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +9 -5
  152. package/dist/fhe-vesting/react/useSplitVesting.d.ts +9 -3
  153. package/dist/index.cjs +18 -18
  154. package/dist/index.js +1 -1
  155. package/dist/testnet-faucet/faucet.d.ts +3 -0
  156. package/dist/testnet-faucet/index.cjs +15 -15
  157. package/dist/testnet-faucet/index.js +3 -3
  158. package/dist/testnet-faucet/react/index.cjs +9 -9
  159. package/dist/testnet-faucet/react/index.js +4 -4
  160. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
3
+ var chunkSUYBAF27_cjs = require('./chunk-SUYBAF27.cjs');
4
4
  var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
5
- var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
5
+ var chunkYAL6JSAZ_cjs = require('./chunk-YAL6JSAZ.cjs');
6
6
  var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
7
7
  var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
8
8
  var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
@@ -446,7 +446,7 @@ var ConfidentialVestingFactoryClient = class {
446
446
  this.walletClient = config.walletClient;
447
447
  const chainId = config.chainId ?? config.publicClient.chain?.id;
448
448
  const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
449
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getFheVestingFactoryAddress(chainId));
449
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkYAL6JSAZ_cjs.getFheVestingFactoryAddress(chainId));
450
450
  if (!resolved) {
451
451
  throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
452
452
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
@@ -464,36 +464,9 @@ var ConfidentialVestingFactoryClient = class {
464
464
  hasWallet: !!this.walletClient,
465
465
  aclResolved: true,
466
466
  // factory has no ACL dependency; constant for funnel-shape parity with manager.
467
- sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
467
+ sdkVersion: chunkSUYBAF27_cjs.SDK_VERSION
468
468
  });
469
469
  }
470
- // ----------------------- writes -----------------------
471
- /**
472
- * Deploy a new `ConfidentialVestingManager` clone via the factory and return
473
- * its address, parsed from the `ManagerCreated` event in the tx receipt.
474
- *
475
- * **This is the headline factory entry point.** It returns one rich-return
476
- * shape: the address is only knowable after the tx mines (the factory packs
477
- * `block.number` into the clone's immutable args), so a hash-only variant
478
- * would force consumers to re-derive what the SDK already had to compute.
479
- *
480
- * Calls `createManagerWithOptions` when `splitEnabled` or `pausableEnabled`
481
- * is provided; otherwise calls the simpler `createManager` entry point.
482
- *
483
- * Internally: `writeContract` → {@link PublicClient.waitForTransactionReceipt} →
484
- * `parseEventLogs({ eventName: "ManagerCreated" })`.
485
- *
486
- * Pre-mine prediction is exposed only on
487
- * `ConfidentialVestingFactoryAdvancedClient` from
488
- * `@tokenops/sdk/fhe-vesting/advanced` — predict at block N, mine at N+1,
489
- * the addresses differ.
490
- *
491
- * @example
492
- * const { hash, manager } = await factory.createManager({
493
- * token: "0xYourToken",
494
- * userSalt: "0x0000000000000000000000000000000000000000000000000000000000000001",
495
- * });
496
- */
497
470
  async createManager(args) {
498
471
  return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-vesting.factory.createManager", async () => {
499
472
  const hasOptions = args.splitEnabled !== void 0 || args.pausableEnabled !== void 0;
@@ -502,28 +475,12 @@ var ConfidentialVestingFactoryClient = class {
502
475
  [args.token, args.userSalt, args.splitEnabled ?? true, args.pausableEnabled ?? true],
503
476
  args.account
504
477
  ) : await this.#write("createManager", [args.token, args.userSalt], args.account);
478
+ if (args.waitForReceipt === false) {
479
+ return { hash: chunk66IHPTOK_cjs.asTxHash(hash), manager: void 0, pending: true };
480
+ }
505
481
  return this.#resolveManagerFromReceipt(hash, "createManager");
506
482
  });
507
483
  }
508
- /**
509
- * Deploy a new manager clone and return its address, parsed from the
510
- * `ManagerCreated` event in the tx receipt.
511
- *
512
- * This is the recommended entry point for the common "deploy a clone and use
513
- * its address" flow. {@link ConfidentialVestingFactoryClient.predictManagerAddress}
514
- * is unreliable on a live chain because the factory packs the deployment
515
- * block number into the clone's immutable args — predict at block N, mine at
516
- * N+1, and the addresses differ.
517
- *
518
- * Internally: {@link ConfidentialVestingFactoryClient.createManager} →
519
- * {@link PublicClient.waitForTransactionReceipt} →
520
- * `parseEventLogs({ eventName: "ManagerCreated" })`.
521
- *
522
- * @example
523
- * const { hash, manager } = await factory.createManagerAndGetAddress({
524
- * token, userSalt,
525
- * });
526
- */
527
484
  async createManagerAndGetAddress(args) {
528
485
  return this.createManager(args);
529
486
  }
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
3
+ var chunkSUYBAF27_cjs = require('./chunk-SUYBAF27.cjs');
4
4
  var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
5
- var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
5
+ var chunkYAL6JSAZ_cjs = require('./chunk-YAL6JSAZ.cjs');
6
6
  var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
7
7
  var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
8
8
  var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
@@ -1826,7 +1826,7 @@ var TestnetFaucetClient = class {
1826
1826
  this.#chainId = chainId;
1827
1827
  assertTestnetFaucetChain(chainId);
1828
1828
  const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
1829
- const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getConfidentialTestTokenAddress(chainId));
1829
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkYAL6JSAZ_cjs.getConfidentialTestTokenAddress(chainId));
1830
1830
  if (!resolved) {
1831
1831
  throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
1832
1832
  reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
@@ -1841,7 +1841,7 @@ var TestnetFaucetClient = class {
1841
1841
  this.#telemetry?.event("testnet-faucet.client.init", {
1842
1842
  chainId: chainId ?? null,
1843
1843
  hasWallet: !!this.walletClient,
1844
- sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
1844
+ sdkVersion: chunkSUYBAF27_cjs.SDK_VERSION
1845
1845
  });
1846
1846
  }
1847
1847
  // ============================================================
@@ -1864,7 +1864,7 @@ var TestnetFaucetClient = class {
1864
1864
  */
1865
1865
  async underlyingToken() {
1866
1866
  if (this.#cachedUnderlying) return this.#cachedUnderlying;
1867
- const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getTestTokenAddress(this.#chainId);
1867
+ const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : chunkYAL6JSAZ_cjs.getTestTokenAddress(this.#chainId);
1868
1868
  const resolved = fromRegistry ?? await this.#readCtt("underlying");
1869
1869
  this.#cachedUnderlying = chunkJK4XMMKM_cjs.normaliseAddress(resolved);
1870
1870
  return this.#cachedUnderlying;
@@ -1,4 +1,4 @@
1
1
  // src/core/version.ts
2
- var SDK_VERSION = "1.0.0";
2
+ var SDK_VERSION = "2.0.0-alpha.4";
3
3
 
4
4
  export { SDK_VERSION };
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkWJLECC22_cjs = require('./chunk-WJLECC22.cjs');
3
+ var chunkUUSSWOPR_cjs = require('./chunk-UUSSWOPR.cjs');
4
4
  var chunk3QHNYEQD_cjs = require('./chunk-3QHNYEQD.cjs');
5
- var chunkUHHMVBLU_cjs = require('./chunk-UHHMVBLU.cjs');
6
- var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
5
+ var chunk6AYJRUGP_cjs = require('./chunk-6AYJRUGP.cjs');
6
+ var chunkYAL6JSAZ_cjs = require('./chunk-YAL6JSAZ.cjs');
7
7
  var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
8
8
  var react = require('react');
9
9
  var wagmi = require('wagmi');
@@ -26,7 +26,7 @@ function useHookFiredEvent(hookName, telemetry, hasWallet, chainId) {
26
26
  function tryResolveFactoryAddress(override, chainId) {
27
27
  if (override) return override;
28
28
  if (chainId === void 0) return void 0;
29
- return chunkFT5H2Q7Y_cjs.getFheVestingFactoryAddress(chainId);
29
+ return chunkYAL6JSAZ_cjs.getFheVestingFactoryAddress(chainId);
30
30
  }
31
31
  function useMemoFactoryClient(opts = {}) {
32
32
  const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
@@ -39,7 +39,7 @@ function useMemoFactoryClient(opts = {}) {
39
39
  const client = react.useMemo(() => {
40
40
  if (!publicClient) return void 0;
41
41
  if (!resolvedAddress) return void 0;
42
- return chunkUHHMVBLU_cjs.createConfidentialVestingFactoryClient({
42
+ return chunk6AYJRUGP_cjs.createConfidentialVestingFactoryClient({
43
43
  publicClient,
44
44
  ...walletClient ? { walletClient } : {},
45
45
  address: resolvedAddress,
@@ -66,7 +66,7 @@ function computeFactoryResolutionError(override, chainId) {
66
66
  clientLabel: "ConfidentialVestingFactoryClient"
67
67
  });
68
68
  }
69
- const resolved = chunkFT5H2Q7Y_cjs.getFheVestingFactoryAddress(chainId);
69
+ const resolved = chunkYAL6JSAZ_cjs.getFheVestingFactoryAddress(chainId);
70
70
  if (!resolved) {
71
71
  return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
72
72
  reason: "registry-not-deployed",
@@ -89,7 +89,7 @@ function useMemoManagerClient(opts) {
89
89
  const client = react.useMemo(() => {
90
90
  if (!publicClient) return void 0;
91
91
  if (!opts.address) return void 0;
92
- return chunkWJLECC22_cjs.createConfidentialVestingManagerClient({
92
+ return chunkUUSSWOPR_cjs.createConfidentialVestingManagerClient({
93
93
  publicClient,
94
94
  ...walletClient ? { walletClient } : {},
95
95
  address: opts.address,
@@ -1,6 +1,6 @@
1
- import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
1
+ import { SDK_VERSION } from './chunk-7KY4K4PH.js';
2
2
  import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
3
- import { getConfidentialTestTokenAddress, getTestTokenAddress } from './chunk-A4DCEE33.js';
3
+ import { getConfidentialTestTokenAddress, getTestTokenAddress } from './chunk-GHGF65LN.js';
4
4
  import { normaliseAddress } from './chunk-ZA673I3O.js';
5
5
  import { asEncryptedHandle, asTxHash } from './chunk-KWFFIJYX.js';
6
6
  import { TokenOpsSdkError, UnsupportedChainError, DeploymentAddressUnavailableError, TokenOpsContractError, ReceiptEventNotFoundError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, InvalidArgumentError } from './chunk-QBJ7O2B4.js';
@@ -1,7 +1,7 @@
1
- import { createConfidentialVestingManagerClient } from './chunk-TWT3STIX.js';
1
+ import { createConfidentialVestingManagerClient } from './chunk-K3R27WX4.js';
2
2
  import { resolveEncryptor } from './chunk-6GNR22OV.js';
3
- import { createConfidentialVestingFactoryClient } from './chunk-WJMEBBU7.js';
4
- import { getFheVestingFactoryAddress } from './chunk-A4DCEE33.js';
3
+ import { createConfidentialVestingFactoryClient } from './chunk-TWU7L5H7.js';
4
+ import { getFheVestingFactoryAddress } from './chunk-GHGF65LN.js';
5
5
  import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
6
6
  import { useMemo, useRef, useEffect } from 'react';
7
7
  import { usePublicClient, useWalletClient } from 'wagmi';
@@ -1,8 +1,8 @@
1
1
  import { mapZamaError } from './chunk-WMACINXO.js';
2
2
  import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-ZWXJTBZO.js';
3
- import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
3
+ import { SDK_VERSION } from './chunk-7KY4K4PH.js';
4
4
  import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
5
- import { getFheDisperseSingletonAddress } from './chunk-A4DCEE33.js';
5
+ import { getFheDisperseSingletonAddress } from './chunk-GHGF65LN.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';
@@ -2272,7 +2272,8 @@ var ConfidentialDisperseClient = class {
2272
2272
  *
2273
2273
  * Internally composes:
2274
2274
  * - `isRegistered` + `getWallets` / `predictWallets`
2275
- * - `hasApprovedSubwallets` (wallet modes) or `isOperator(sender, singleton)` (direct mode)
2275
+ * - `isOperator(sender, singleton)` (every mode: each one pulls from the sender) and,
2276
+ * for the wallet modes, `hasApprovedSubwallets` as well
2276
2277
  * - `calculateFee` / `getBatchLimits`
2277
2278
  * - Structural recipient + amount validation
2278
2279
  *
@@ -2287,12 +2288,25 @@ var ConfidentialDisperseClient = class {
2287
2288
  const { user, token, recipients, amounts, mode } = args;
2288
2289
  assertChecksumAddress(user, "user", "preflightDisperse");
2289
2290
  assertChecksumAddress(token, "token", "preflightDisperse");
2290
- const [isUserRegistered, predictedWallets, batchLimits, callerBalance, isPaused] = await Promise.all([
2291
+ const [
2292
+ isUserRegistered,
2293
+ predictedWallets,
2294
+ batchLimits,
2295
+ callerBalance,
2296
+ isPaused,
2297
+ hasApprovedSingleton
2298
+ ] = await Promise.all([
2291
2299
  this.isRegistered(user),
2292
2300
  this.predictWallets(user),
2293
2301
  this.getBatchLimits(),
2294
2302
  this.publicClient.getBalance({ address: user }),
2295
- this.paused()
2303
+ this.paused(),
2304
+ this.publicClient.readContract({
2305
+ address: token,
2306
+ abi: ERC7984_IS_OPERATOR_ABI,
2307
+ functionName: "isOperator",
2308
+ args: [user, this.address]
2309
+ })
2296
2310
  ]);
2297
2311
  const wallets = isUserRegistered ? await this.getWallets(user) : null;
2298
2312
  let hasApprovedSubwallets = {
@@ -2300,15 +2314,7 @@ var ConfidentialDisperseClient = class {
2300
2314
  wallet1: false,
2301
2315
  both: false
2302
2316
  };
2303
- let hasApprovedSingleton = null;
2304
- if (mode === "direct") {
2305
- hasApprovedSingleton = await this.publicClient.readContract({
2306
- address: token,
2307
- abi: ERC7984_IS_OPERATOR_ABI,
2308
- functionName: "isOperator",
2309
- args: [user, this.address]
2310
- });
2311
- } else {
2317
+ if (mode !== "direct") {
2312
2318
  if (isUserRegistered) {
2313
2319
  hasApprovedSubwallets = await this.hasApprovedSubwallets({ user, token });
2314
2320
  } else if (predictedWallets) {
@@ -2390,7 +2396,7 @@ var ConfidentialDisperseClient = class {
2390
2396
  );
2391
2397
  }
2392
2398
  }
2393
- if (mode === "direct" && hasApprovedSingleton === false) {
2399
+ if (!hasApprovedSingleton) {
2394
2400
  blockers.push("Sender has not approved the singleton as operator on the token");
2395
2401
  blockerErrors.push(
2396
2402
  new SingletonNotApprovedError({
@@ -2439,18 +2445,6 @@ var ConfidentialDisperseClient = class {
2439
2445
  blockerErrors
2440
2446
  };
2441
2447
  }
2442
- // ============================================================
2443
- // WRITE METHODS
2444
- // ============================================================
2445
- /**
2446
- * Register the caller's dedicated wallet pair for wallet-mode disperses.
2447
- *
2448
- * Deploys two deterministic ERC-1167 wallet clones and approves them for `token`.
2449
- * Can only be called once per user — subsequent calls revert with `UserAlreadyRegistered`.
2450
- *
2451
- * @returns `{ hash, wallets }` — `wallets` is parsed from the `UserRegistered` event.
2452
- * @throws {DisperseSubwalletNotFoundError} if no `UserRegistered` event matching the singleton is found.
2453
- */
2454
2448
  async register(args) {
2455
2449
  return withTelemetry(this.#telemetry, "fhe-disperse.singleton.register", async () => {
2456
2450
  assertChecksumAddress(args.token, "token", "register");
@@ -2473,6 +2467,9 @@ var ConfidentialDisperseClient = class {
2473
2467
  } catch (err) {
2474
2468
  throw this.#mapRevert("register", err, { user: userAddress }, userAddress);
2475
2469
  }
2470
+ if (args.waitForReceipt === false) {
2471
+ return { hash, wallets: void 0, pending: true };
2472
+ }
2476
2473
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2477
2474
  const events = parseEventLogs({
2478
2475
  abi: disperseConfidentialAbi,
@@ -2532,32 +2529,6 @@ var ConfidentialDisperseClient = class {
2532
2529
  const user = this.#userAddressFromOverride(args.account, "recoverERC20FromWallets");
2533
2530
  return this.#write("recoverERC20FromWallets", [args.token, args.to], args.account, { user });
2534
2531
  }
2535
- /**
2536
- * Disperse confidential tokens to multiple recipients.
2537
- *
2538
- * SDK responsibilities:
2539
- * 1. Validates input deterministically (lengths, zero addresses, per-amount
2540
- * uint64 bounds, wallet-mode subtotal overflow, batch-limit for the
2541
- * selected mode) — using the same {@link validateDisperseInputs} helper
2542
- * `preflightDisperse` uses, so an oversized or malformed batch is rejected
2543
- * before any FHE encryption time is spent.
2544
- * 2. For wallet modes: computes group subtotals using the contract's exact split rule.
2545
- * 3. Encrypts amounts + subtotals in a single batch call (one input proof).
2546
- * 4. Computes `msg.value` for gas-fee modes; `0` for token-fee mode.
2547
- * 5. Dispatches to the correct contract function based on `mode`.
2548
- *
2549
- * **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.
2550
- *
2551
- * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2552
- * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2553
- * ERC-20. Amount parameters are base units of the token's actual decimals:
2554
- * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2555
- * transparent TTT test token uses 18 decimals. Every entry of `amounts[]`
2556
- * follows this convention.
2557
- *
2558
- * @throws {TokenOpsSdkError} on input validation failure (first deterministic error).
2559
- * @throws {TokenOpsSdkError} if no encryptor is available at call time.
2560
- */
2561
2532
  async disperse(args) {
2562
2533
  return withTelemetry(this.#telemetry, "fhe-disperse.singleton.disperse", async () => {
2563
2534
  const { token, mode, recipients, amounts } = args;
@@ -2590,7 +2561,8 @@ var ConfidentialDisperseClient = class {
2590
2561
  wallet,
2591
2562
  userAddr,
2592
2563
  enc,
2593
- gasFeeOverride: args.gasFeeOverride
2564
+ gasFeeOverride: args.gasFeeOverride,
2565
+ waitForReceipt: args.waitForReceipt
2594
2566
  });
2595
2567
  }
2596
2568
  return this.#disperseWallet({
@@ -2602,7 +2574,8 @@ var ConfidentialDisperseClient = class {
2602
2574
  wallet,
2603
2575
  userAddr,
2604
2576
  enc,
2605
- gasFeeOverride: args.gasFeeOverride
2577
+ gasFeeOverride: args.gasFeeOverride,
2578
+ waitForReceipt: args.waitForReceipt
2606
2579
  });
2607
2580
  });
2608
2581
  }
@@ -2863,32 +2836,6 @@ var ConfidentialDisperseClient = class {
2863
2836
  assertNonZeroChecksumAddress(to, "to", "withdrawGasFee");
2864
2837
  return this.#write("withdrawGasFee", [to, amount], account);
2865
2838
  }
2866
- /**
2867
- * Withdraw accumulated encrypted token fees.
2868
- *
2869
- * The amount is encrypted by the caller — pass plaintext `amount` and an
2870
- * encryptor, or pass `encryptedInput` directly. The contract caps the
2871
- * withdrawal at the available reserve via `FHE.min`.
2872
- *
2873
- * **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
2874
- * convention (1 token = 1_000_000 base units), not the 18 decimals typical of
2875
- * ERC-20. Amount parameters are base units of the token's actual decimals:
2876
- * for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
2877
- * transparent TTT test token uses 18 decimals.
2878
- *
2879
- * Returns the tx hash plus the **transferred** handle parsed from the
2880
- * `TokenFeeWithdrawn` event. Decrypt the handle via Zama's `userDecrypt`
2881
- * to view the actual amount moved (which can be less than requested when
2882
- * the reserve was smaller than the request). The caller is granted
2883
- * persistent ACL on this handle by the contract.
2884
- *
2885
- * **`encryptedInput` is bound to (this singleton, this caller).** Zama's
2886
- * KMSVerifier rejects proofs whose `contractAddress` or `userAddress`
2887
- * don't match the executing tx. If you pre-encrypt on a different chain's
2888
- * singleton, or for a different caller, the on-chain submission will
2889
- * revert with a generic verification failure. The plaintext `amount`
2890
- * path is safer when the caller / chain isn't fixed yet.
2891
- */
2892
2839
  async withdrawTokenFee(args) {
2893
2840
  assertChecksumAddress(args.token, "token", "withdrawTokenFee");
2894
2841
  assertNonZeroChecksumAddress(args.to, "to", "withdrawTokenFee");
@@ -2920,6 +2867,9 @@ var ConfidentialDisperseClient = class {
2920
2867
  } catch (err) {
2921
2868
  throw this.#mapRevert("withdrawTokenFee", err, void 0, accountAddress(account));
2922
2869
  }
2870
+ if (args.waitForReceipt === false) {
2871
+ return { hash, transferredHandle: void 0, pending: true };
2872
+ }
2923
2873
  const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2924
2874
  const events = parseEventLogs({
2925
2875
  abi: disperseConfidentialAbi,
@@ -3050,6 +3000,7 @@ var ConfidentialDisperseClient = class {
3050
3000
  } catch (err) {
3051
3001
  throw this.#mapRevert("disperse[direct]", err, { user: userAddr }, userAddr);
3052
3002
  }
3003
+ if (args.waitForReceipt === false) return { hash, distributions: void 0, pending: true };
3053
3004
  const distributions = await this.#parseDirectDistributions(hash);
3054
3005
  return { hash, distributions };
3055
3006
  }
@@ -3100,6 +3051,7 @@ var ConfidentialDisperseClient = class {
3100
3051
  } catch (err) {
3101
3052
  throw this.#mapRevert("disperse[wallet-token-fee]", err, { user: userAddr }, userAddr);
3102
3053
  }
3054
+ if (args.waitForReceipt === false) return { hash: hash2, distributions: void 0, pending: true };
3103
3055
  const distributions2 = await this.#parseWalletDistributions(hash2);
3104
3056
  return { hash: hash2, distributions: distributions2 };
3105
3057
  }
@@ -3137,6 +3089,7 @@ var ConfidentialDisperseClient = class {
3137
3089
  } catch (err) {
3138
3090
  throw this.#mapRevert("disperse[wallet]", err, { user: userAddr }, userAddr);
3139
3091
  }
3092
+ if (args.waitForReceipt === false) return { hash, distributions: void 0, pending: true };
3140
3093
  const distributions = await this.#parseWalletDistributions(hash);
3141
3094
  return { hash, distributions };
3142
3095
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkPZZK3O3S_cjs = require('./chunk-PZZK3O3S.cjs');
4
- var chunkAREQJHKA_cjs = require('./chunk-AREQJHKA.cjs');
3
+ var chunkE4IV4M4E_cjs = require('./chunk-E4IV4M4E.cjs');
4
+ var chunkVHKMWWBA_cjs = require('./chunk-VHKMWWBA.cjs');
5
5
  var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
6
6
  var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
7
7
  var merkleTree = require('@openzeppelin/merkle-tree');
@@ -148,7 +148,7 @@ function validateCampaignRecipientsInternal(recipients, method) {
148
148
  seen.set(key, index);
149
149
  });
150
150
  }
151
- async function encryptRoster({ instance, recipients, encryptor, submitter }, method) {
151
+ async function encryptRoster({ instance, recipients, encryptor }, method) {
152
152
  validateCampaignRecipientsInternal(recipients, method);
153
153
  if (!viem.isAddress(instance, { strict: false })) {
154
154
  throw new chunk67OV5CX2_cjs.InvalidArgumentError({
@@ -165,73 +165,36 @@ async function encryptRoster({ instance, recipients, encryptor, submitter }, met
165
165
  reason: "is the zero address; inputs must be bound to the airdrop instance"
166
166
  });
167
167
  }
168
- const enc = chunkPZZK3O3S_cjs.resolveEncryptor(encryptor);
168
+ const enc = chunkE4IV4M4E_cjs.resolveEncryptor(encryptor);
169
169
  if (!enc) {
170
170
  throw new chunk67OV5CX2_cjs.MissingEncryptorError(method, {
171
171
  hint: "Pass an encryptor instance, or a lazy factory that returns one."
172
172
  });
173
173
  }
174
- if (submitter !== void 0) {
175
- if (!viem.isAddress(submitter, { strict: false })) {
176
- throw new chunk67OV5CX2_cjs.InvalidArgumentError({
177
- method,
178
- argument: "submitter",
179
- reason: "is not a 20-byte hex address",
180
- value: submitter
181
- });
182
- }
183
- if (viem.isAddressEqual(submitter, viem.zeroAddress)) {
184
- throw new chunk67OV5CX2_cjs.InvalidArgumentError({
185
- method,
186
- argument: "submitter",
187
- reason: "is the zero address; no proof can be bound to it, so no leaf would be claimable"
188
- });
189
- }
190
- }
191
174
  const airdrop = chunkJK4XMMKM_cjs.normaliseAddress(instance);
192
175
  const accounts = recipients.map((r) => chunkJK4XMMKM_cjs.normaliseAddress(r.recipient));
193
- if (submitter !== void 0) {
194
- const boundTo = chunkJK4XMMKM_cjs.normaliseAddress(submitter);
195
- const chunks = [];
196
- for (let i = 0; i < recipients.length; i += MERKLE_BATCH_LIMIT) {
197
- chunks.push(recipients.slice(i, i + MERKLE_BATCH_LIMIT));
198
- }
199
- const encryptedChunks = await Promise.all(
200
- chunks.map(
201
- (chunk) => chunkPZZK3O3S_cjs.encryptUint64Batch({
202
- encryptor: enc,
203
- contractAddress: airdrop,
204
- userAddress: boundTo,
205
- values: chunk.map((r) => r.cumulativeTotal)
206
- })
207
- )
208
- );
209
- return accounts.map((account, i) => {
210
- const chunk = encryptedChunks[Math.floor(i / MERKLE_BATCH_LIMIT)];
211
- return {
212
- account,
213
- boundTo,
214
- handle: chunk.handles[i % MERKLE_BATCH_LIMIT],
215
- inputProof: chunk.inputProof
216
- };
217
- });
176
+ const chunks = [];
177
+ for (let i = 0; i < recipients.length; i += MERKLE_BATCH_LIMIT) {
178
+ chunks.push(recipients.slice(i, i + MERKLE_BATCH_LIMIT));
218
179
  }
219
- const encrypted = await Promise.all(
220
- recipients.map(
221
- (r, i) => chunkPZZK3O3S_cjs.encryptUint64({
180
+ const encryptedChunks = await Promise.all(
181
+ chunks.map(
182
+ (chunk) => chunkE4IV4M4E_cjs.encryptUint64Batch({
222
183
  encryptor: enc,
223
184
  contractAddress: airdrop,
224
- userAddress: accounts[i],
225
- value: r.cumulativeTotal
185
+ userAddress: airdrop,
186
+ values: chunk.map((r) => r.cumulativeTotal)
226
187
  })
227
188
  )
228
189
  );
229
- return accounts.map((account, i) => ({
230
- account,
231
- boundTo: account,
232
- handle: encrypted[i].handle,
233
- inputProof: encrypted[i].inputProof
234
- }));
190
+ return accounts.map((account, i) => {
191
+ const chunk = encryptedChunks[Math.floor(i / MERKLE_BATCH_LIMIT)];
192
+ return {
193
+ account,
194
+ handle: chunk.handles[i % MERKLE_BATCH_LIMIT],
195
+ inputProof: chunk.inputProof
196
+ };
197
+ });
235
198
  }
236
199
  async function encryptCampaignAmounts(args) {
237
200
  return encryptRoster(args, "encryptCampaignAmounts");
@@ -239,13 +202,9 @@ async function encryptCampaignAmounts(args) {
239
202
  async function buildMerkleCampaign({
240
203
  instance,
241
204
  recipients,
242
- encryptor,
243
- submitter
205
+ encryptor
244
206
  }) {
245
- const leaves = await encryptRoster(
246
- { instance, recipients, encryptor, submitter },
247
- "buildMerkleCampaign"
248
- );
207
+ const leaves = await encryptRoster({ instance, recipients, encryptor }, "buildMerkleCampaign");
249
208
  return buildMerkleTreeInternal({ instance, leaves }, "buildMerkleCampaign");
250
209
  }
251
210
  async function planMerkleCampaign({
@@ -255,8 +214,7 @@ async function planMerkleCampaign({
255
214
  creator,
256
215
  userSalt,
257
216
  recipients,
258
- encryptor,
259
- submitter
217
+ encryptor
260
218
  }) {
261
219
  validateCampaignRecipientsInternal(recipients, "planMerkleCampaign");
262
220
  const initCodeHashBefore = await factory.getMerkleInitCodeHash({ params, mode });
@@ -269,11 +227,10 @@ async function planMerkleCampaign({
269
227
  const campaign = await buildMerkleCampaign({
270
228
  instance: predictedAddress,
271
229
  recipients,
272
- encryptor,
273
- submitter
230
+ encryptor
274
231
  });
275
232
  const initCodeHashAfter = await factory.getMerkleInitCodeHash({ params, mode });
276
- chunkAREQJHKA_cjs.assertPredictionFresh({
233
+ chunkVHKMWWBA_cjs.assertPredictionFresh({
277
234
  variant: "merkle",
278
235
  initCodeHashBefore,
279
236
  initCodeHashAfter,
@@ -286,14 +243,12 @@ async function rotateMerkleRoot({
286
243
  airdrop,
287
244
  recipients,
288
245
  encryptor,
289
- submitter,
290
246
  account
291
247
  }) {
292
248
  const campaign = await buildMerkleCampaign({
293
249
  instance: airdrop.address,
294
250
  recipients,
295
- encryptor,
296
- submitter
251
+ encryptor
297
252
  });
298
253
  const hash = await airdrop.setMerkleRoot({ newRoot: campaign.root, account });
299
254
  return { ...campaign, hash };
@@ -311,7 +266,7 @@ var ASSIGNABLE_ROLES = [
311
266
  function planInstanceRoleSplit(args) {
312
267
  const { assignment, caller, airdropType } = args;
313
268
  if (assignment.feeCollector !== void 0) {
314
- throw new chunkAREQJHKA_cjs.FeeCollectorSelfAdministeredError({ requestedGrantee: assignment.feeCollector });
269
+ throw new chunkVHKMWWBA_cjs.FeeCollectorSelfAdministeredError({ requestedGrantee: assignment.feeCollector });
315
270
  }
316
271
  const steps = [];
317
272
  for (const { key, role, variant } of ASSIGNABLE_ROLES) {
@@ -339,6 +294,32 @@ function planInstanceRoleSplit(args) {
339
294
  }
340
295
  return steps;
341
296
  }
297
+ function encodeInstanceRoleSplit(args) {
298
+ const constants = {
299
+ DEFAULT_ADMIN_ROLE: DEFAULT_ADMIN_ROLE_CONSTANT,
300
+ ...args.roleConstants
301
+ };
302
+ const resolved = args.steps.map((step, i) => {
303
+ const role = constants[step.role];
304
+ if (role === void 0) {
305
+ throw new chunk67OV5CX2_cjs.InvalidArgumentError({
306
+ method: "encodeInstanceRoleSplit",
307
+ argument: `roleConstants.${step.role}`,
308
+ reason: `steps[${i}] needs the ${step.role} constant; read it off the instance`
309
+ });
310
+ }
311
+ return { step, role };
312
+ });
313
+ return resolved.map(({ step, role }) => ({
314
+ to: args.airdrop,
315
+ data: viem.encodeFunctionData({
316
+ abi: chunkE4IV4M4E_cjs.merkleConfidentialAirdropAbi,
317
+ functionName: step.kind === "grant" ? "grantRole" : "revokeRole",
318
+ args: [role, step.account]
319
+ }),
320
+ value: 0n
321
+ }));
322
+ }
342
323
  function roleGetterAbiEntry(name) {
343
324
  return {
344
325
  inputs: [],
@@ -422,8 +403,10 @@ async function grantInstanceRoles(args) {
422
403
  return outcomes;
423
404
  }
424
405
 
406
+ exports.MERKLE_BATCH_LIMIT = MERKLE_BATCH_LIMIT;
425
407
  exports.buildMerkleCampaign = buildMerkleCampaign;
426
408
  exports.buildMerkleTree = buildMerkleTree;
409
+ exports.encodeInstanceRoleSplit = encodeInstanceRoleSplit;
427
410
  exports.encryptCampaignAmounts = encryptCampaignAmounts;
428
411
  exports.grantInstanceRoles = grantInstanceRoles;
429
412
  exports.leafOf = leafOf;