• Sets a new threshold for a modular smart account.

    This function prepares and sends a user operation to change the threshold of the specified modular smart account. The threshold determines how many owners need to approve a transaction before it can be executed.

    Type Parameters

    • TModularSmartAccount extends undefined | ModularSmartAccount

      Type of the modular smart account, extending ModularSmartAccount or undefined.

    Parameters

    • client: Client<Transport, undefined | Chain, TModularSmartAccount>

      The client used to interact with the blockchain.

    • parameters: SetThresholdParameters<TModularSmartAccount>

      The parameters for setting the new threshold.

    Returns Promise<`0x${string}`>

    A promise that resolves to the hash of the sent user operation.

    If no account is provided and the client doesn't have an associated account.

    const nexusClient = createSmartAccountClient({ ... });
    const hash = await setThreshold(nexusClient, {
    threshold: 2,
    maxFeePerGas: 1000000000n
    });
    console.log(`Set threshold transaction hash: ${hash}`);
    • Ensure that the new threshold is valid for the current number of owners in the account.
    • This operation will modify the state of the smart account on the blockchain.
    • The transaction may fail if the caller doesn't have the necessary permissions to change the threshold.