Skip to main content

fhe-airdrop/advanced

Classes

ConfidentialAirdropFactoryAdvancedClient

Defined in: fhe-airdrop/advanced/factory-advanced.ts:36

Advanced extension of ConfidentialAirdropFactoryClient that re-exposes the CREATE2 address prediction read.

Why this is "advanced" surface. Most consumers want one call back — createConfidentialAirdrop (rich-return, { hash, airdrop }). The factory still emits ConfidentialAirdropCreated, the SDK still parses it, so consumers never need to ask "what address will this deploy to before mining?" Hoisting predictAirdropAddress onto the headline client surface gave consumers a footgun: pass the wrong gasFee and you predict an address that won't match the deployed clone.

For the genuinely-advanced cases — historical address recovery, same-tx pre-confirmation flows — import this subclass from @tokenops/sdk/fhe-airdrop/advanced and call it explicitly. The headline factory does not include this method.

Example

import { createConfidentialAirdropFactoryAdvancedClient } from "@tokenops/sdk/fhe-airdrop/advanced";

const factory = createConfidentialAirdropFactoryAdvancedClient({ publicClient });
const predicted = await factory.predictAirdropAddress({
params, userSalt, deployer, gasFee: customGasFee,
});

Extends

Constructors

Constructor
new ConfidentialAirdropFactoryAdvancedClient(config): ConfidentialAirdropFactoryAdvancedClient;

Defined in: fhe-airdrop/factory.ts:191

Parameters
ParameterType
configConfidentialAirdropFactoryClientConfig
Returns

ConfidentialAirdropFactoryAdvancedClient

Inherited from

ConfidentialAirdropFactoryClient.constructor

Properties

PropertyModifierTypeInherited fromDefined in
publicClientreadonly{ }ConfidentialAirdropFactoryClient.publicClientfhe-airdrop/factory.ts:185
walletClient?readonly... | ...ConfidentialAirdropFactoryClient.walletClientfhe-airdrop/factory.ts:186
addressreadonly`0x${(...)}`ConfidentialAirdropFactoryClient.addressfhe-airdrop/factory.ts:187
encryptor?readonly... | ...ConfidentialAirdropFactoryClient.encryptorfhe-airdrop/factory.ts:188

Methods

predictAirdropAddress()
predictAirdropAddress(args): Promise<...>;

Defined in: fhe-airdrop/advanced/factory-advanced.ts:51

Compute the deterministic CREATE2 address for an airdrop clone without deploying it.

Note: gasFee must match what the factory would charge the deployer at deploy time (custom fee if set, otherwise defaultGasFee). Use getCustomFee(deployer) and defaultGasFee() to resolve it correctly — a mismatch silently targets the wrong address.

For the common "deploy a clone and learn its address" flow, use the headline factory.createConfidentialAirdrop instead — it parses the address from the tx receipt's ConfidentialAirdropCreated event without any gasFee guessing.

Parameters
ParameterType
argsPredictAirdropArgs
Returns

Promise<...>

createConfidentialAirdrop()
createConfidentialAirdrop(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:245

Deploy a new airdrop clone via the factory and return its address, parsed from the ConfidentialAirdropCreated event in the tx receipt.

This is the headline factory entry point. It returns one rich-return shape: most consumers want the deployed address back, and the SDK already waits for and parses the event, so there's no reason to make consumers do it themselves.

Internally: writeContract → PublicClient.waitForTransactionReceipt → parseEventLogs({ eventName: "ConfidentialAirdropCreated" }).

For genuine pre-mine prediction (rare), import ConfidentialAirdropFactoryAdvancedClient from @tokenops/sdk/fhe-airdrop/advanced and call predictAirdropAddress.

Parameters
ParameterType
argsCreateAirdropArgs
Returns

Promise<...>

Example
const { hash, airdrop } = await factory.createConfidentialAirdrop({
params, userSalt,
});
Inherited from

ConfidentialAirdropFactoryClient.createConfidentialAirdrop

createAndFundConfidentialAirdrop()
createAndFundConfidentialAirdrop(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:277

Deploy and fund a new airdrop in a single transaction, and return its address. The SDK encrypts amount into an externalEuint64 before passing to the contract.

Prerequisites: caller must have set this factory as an operator on the token: token.setOperator(factoryAddress, deadline).

Symmetric with ConfidentialAirdropFactoryClient.createConfidentialAirdrop — both return { hash, airdrop } parsed from the ConfidentialAirdropCreated event.

Parameters
ParameterType
argsCreateAndFundAirdropArgs
Returns

Promise<...>

Example
const { hash, airdrop } = await factory.createAndFundConfidentialAirdrop({
params, userSalt, amount: 1_000_000n,
});
Inherited from

ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop

fundConfidentialAirdrop()
fundConfidentialAirdrop(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:335

Fund an existing (or not-yet-deployed) airdrop with encrypted tokens.

Prerequisites: caller must have set this factory as an operator on the token: token.setOperator(factoryAddress, deadline)

Parameters
ParameterType
argsFundAirdropArgs
Returns

Promise<...>

Transaction hash.

Inherited from

ConfidentialAirdropFactoryClient.fundConfidentialAirdrop

createConfidentialAirdropAndGetAddress()
createConfidentialAirdropAndGetAddress(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:393

Deploy a new airdrop clone and return its address, parsed from the ConfidentialAirdropCreated event in the tx receipt.

Symmetry helper with the fhe-vesting client. Use this when you want a one-call "deploy and use" shape; otherwise call ConfidentialAirdropFactoryClient.createConfidentialAirdrop and parse the receipt yourself, or call ConfidentialAirdropFactoryClient.predictAirdropAddress before mining.

Internally: ConfidentialAirdropFactoryClient.createConfidentialAirdrop → PublicClient.waitForTransactionReceipt → parseEventLogs({ eventName: "ConfidentialAirdropCreated" }).

Parameters
ParameterType
argsCreateAirdropArgs
Returns

Promise<...>

Example
const { hash, airdrop } = await factory.createConfidentialAirdropAndGetAddress({
params, userSalt,
});
Inherited from

ConfidentialAirdropFactoryClient.createConfidentialAirdropAndGetAddress

createAndFundConfidentialAirdropAndGetAddress()
createAndFundConfidentialAirdropAndGetAddress(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:415

Deploy AND fund a new airdrop clone in one tx, returning its address parsed from the ConfidentialAirdropCreated event in the receipt.

Symmetry with ConfidentialAirdropFactoryClient.createConfidentialAirdropAndGetAddress — use this when you also need to seed the pool in the same transaction.

Internally: ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop → PublicClient.waitForTransactionReceipt → parseEventLogs({ eventName: "ConfidentialAirdropCreated" }).

Parameters
ParameterType
argsCreateAndFundAirdropArgs
Returns

Promise<...>

Example
const { hash, airdrop } = await factory.createAndFundConfidentialAirdropAndGetAddress({
params, userSalt, amount, encryptor,
});
Inherited from

ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdropAndGetAddress

setFeeCollector()
setFeeCollector(newFeeCollector, account?): Promise<...>;

Defined in: fhe-airdrop/factory.ts:424

Change the fee collector address. FEE_MANAGER_ROLE only.

Parameters
ParameterType
newFeeCollector`0x${(...)}`
account?... | ... | ...
Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.setFeeCollector

setDefaultGasFee()
setDefaultGasFee(newGasFee, account?): Promise<...>;

Defined in: fhe-airdrop/factory.ts:431

Change the default per-claim gas fee in wei. FEE_MANAGER_ROLE only.

Parameters
ParameterType
newGasFeebigint
account?... | ... | ...
Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.setDefaultGasFee

setCustomFee()
setCustomFee(
campaignCreator,
gasFee,
account?): Promise<...>;

Defined in: fhe-airdrop/factory.ts:438

Set a per-creator gas fee override. FEE_MANAGER_ROLE only.

Parameters
ParameterType
campaignCreator`0x${(...)}`
gasFeebigint
account?... | ... | ...
Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.setCustomFee

disableCustomFee()
disableCustomFee(campaignCreator, account?): Promise<...>;

Defined in: fhe-airdrop/factory.ts:449

Remove a per-creator fee override, reverting to defaultGasFee. FEE_MANAGER_ROLE only.

Parameters
ParameterType
campaignCreator`0x${(...)}`
account?... | ... | ...
Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.disableCustomFee

implementation()
implementation(): Promise<...>;

Defined in: fhe-airdrop/factory.ts:458

Current LibClone implementation address.

Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.implementation

airdropImplementation()
airdropImplementation(): Promise<...>;

Defined in: fhe-airdrop/factory.ts:474

Alias for ConfidentialAirdropFactoryClient.implementation that matches the contract's storage field name (_airdropImplementation).

Provided for parity with fhe-vesting's managerImplementation() alias. The airdrop factory has the same LibClone shape mirroring _airdropImplementation storage, so server devs reading the Solidity first reach for factory.airdropImplementation() via autocomplete and would otherwise hit a TS2551 on the SDK's implementation() shape. The canonical implementation() method is retained for backwards-compat and cross-factory uniformity.

Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.airdropImplementation

defaultGasFee()
defaultGasFee(): Promise<...>;

Defined in: fhe-airdrop/factory.ts:479

Default per-claim gas fee in wei. Used when no custom fee is set for the campaign creator.

Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.defaultGasFee

feeCollector()
feeCollector(): Promise<...>;

Defined in: fhe-airdrop/factory.ts:484

Address authorized to collect gas fees from airdrop clones.

Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.feeCollector

getCustomFee()
getCustomFee(campaignCreator): Promise<...>;

Defined in: fhe-airdrop/factory.ts:489

Per-creator custom fee override. enabled is false when no override is set.

Parameters
ParameterType
campaignCreator`0x${(...)}`
Returns

Promise<...>

Inherited from

ConfidentialAirdropFactoryClient.getCustomFee

getInitCodeHash()
getInitCodeHash(args): Promise<...>;

Defined in: fhe-airdrop/factory.ts:503

Compute the CREATE2 init-code hash for a given set of params and gas fee. Useful for deriving the clone address off-chain. Use predictAirdropAddress from @tokenops/sdk/fhe-airdrop/advanced for the full address derivation.

Parameters
ParameterTypeDescription
args{ params: ...; gasFee: ...; }{ params, gasFee } — must match the values used at deploy time.
args.params...-
args.gasFee...-
Returns

Promise<...>

bytes32 init-code hash.

Inherited from

ConfidentialAirdropFactoryClient.getInitCodeHash

Functions

createConfidentialAirdropFactoryAdvancedClient()

function createConfidentialAirdropFactoryAdvancedClient(config): ConfidentialAirdropFactoryAdvancedClient;

Defined in: fhe-airdrop/advanced/factory-advanced.ts:69

Create a ConfidentialAirdropFactoryAdvancedClient. Mirrors viem's create* convention.

Parameters

ParameterType
configConfidentialAirdropFactoryClientConfig

Returns

ConfidentialAirdropFactoryAdvancedClient

Example

const factory = createConfidentialAirdropFactoryAdvancedClient({ publicClient, walletClient, encryptor });
const predicted = await factory.predictAirdropAddress({ params, userSalt, deployer, gasFee });