import type { Address } from 'abitype'; import type * as Hex from 'ox/Hex'; import { MultisigConfig, MultisigOperation } from 'ox/tempo'; import type { Account } from '../../accounts/types.js'; import type { ReadContractReturnType } from '../../actions/public/readContract.js'; import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js'; import { writeContract } from '../../actions/wallet/writeContract.js'; import { writeContractSync } from '../../actions/wallet/writeContractSync.js'; import type { Client } from '../../clients/createClient.js'; import type { Transport } from '../../clients/transports/createTransport.js'; import type { BaseErrorType } from '../../errors/base.js'; import type { Chain } from '../../types/chain.js'; import type { Log } from '../../types/log.js'; import type { Compute } from '../../types/utils.js'; import * as Abis from '../Abis.js'; import type { ReadParameters, WriteParameters } from '../internal/types.js'; import type * as Transaction from '../Transaction.js'; /** * Gets the current cached config for a multisig account. * * The coordinator reads the account's current onchain commitment and returns * the matching config from its store. It returns `null` when the config is not * cached. * * @example * ```ts * const config = await client.multisig.getConfig({ * address: '0x...', * }) * ``` * * @param client - Client. * @param parameters - Parameters. * @returns The config, or `null` when it is unknown. */ export declare function getConfig(client: Client, parameters: getConfig.Parameters): Promise; export declare namespace getConfig { /** Parameters for {@link getConfig}. */ type Parameters = { /** Multisig account address. */ address: Address; }; /** Return value for {@link getConfig}. */ type ReturnValue = MultisigConfig.Config | null; /** Error type for {@link getConfig}. */ type ErrorType = BaseErrorType; } /** * Gets the current configuration commitment for a native multisig account. * * @example * ```ts * import { createClient, http } from 'viem' * import { tempo } from 'viem/chains' * import { Actions } from 'viem/tempo' * * const client = createClient({ * chain: tempo, * transport: http(), * }) * * const commitment = await Actions.multisig.getConfigCommitment(client, { * account: '0x...', * }) * ``` * * @param client - Client. * @param parameters - Parameters. * @returns The current configuration commitment, or zero when no config has * been committed. */ export declare function getConfigCommitment(client: Client, parameters: getConfigCommitment.Parameters): Promise; export declare namespace getConfigCommitment { type Parameters = ReadParameters & Args; type Args = { /** Initialized multisig account address. */ account: Address; }; type ReturnValue = ReadContractReturnType; /** * Defines a call to the `getConfigCommitment` function. * * Can be passed to [`multicall`](https://viem.sh/docs/contract/multicall). * * @param args - Arguments. * @returns The call. */ function call(args: Args): { abi: [{ readonly name: "getConfigCommitment"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "account"; }]; readonly outputs: readonly [{ readonly type: "bytes32"; readonly name: "commitment"; }]; }]; functionName: "getConfigCommitment"; } & { args: readonly [account: `0x${string}`]; } & { address: Address; } & { data: import("../../index.js").Hex; to: Address; }; } /** * Gets a coordinated multisig operation by its hash. * * @param client - Client. * @param parameters - Parameters. * @returns The operation, or `null` when it is unknown. */ export declare function getOperation(client: Client, parameters: getOperation.Parameters): Promise; export declare namespace getOperation { /** Parameters for {@link getOperation}. */ type Parameters = { /** Multisig operation hash. */ hash: Hex.Hex; }; /** Return value for {@link getOperation}. */ type ReturnValue = MultisigOperation.Operation | null; /** Error type for {@link getOperation}. */ type ErrorType = BaseErrorType; } /** * Replaces the current configuration for a native multisig account. * * The transaction must be authorized directly by the account's current owner * quorum. Local owner-signing flows can include {@link updateConfig.call} in a * prepared transaction before collecting approvals. * * @example * ```ts * import { createClient, http } from 'viem' * import { sendTransactionSync } from 'viem/actions' * import { tempoLocalnet } from 'viem/chains' * import { Account, Actions } from 'viem/tempo' * * const owner = Account.fromSecp256k1( * '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', * ) * const account = Account.fromMultisig({ * address: 'infer', * owners: [owner], * }) * const client = createClient({ * chain: tempoLocalnet, * transport: http(), * }) * * await sendTransactionSync(client, { * account, * to: account.address, * }) * * const hash = await Actions.multisig.updateConfig(client, { * account, * nextConfig: { * owners: [{ owner: owner.address, weight: 1 }], * threshold: 1, * }, * }) * ``` * * @param client - Client. * @param parameters - Parameters. * @returns The transaction hash. */ export declare function updateConfig(client: Client, parameters: updateConfig.Parameters): Promise; export declare namespace updateConfig { type Parameters = WriteParameters & { /** Complete current config. Inferred from the account or coordinator when omitted. */ currentConfig?: MultisigConfig.Config | undefined; /** Replacement owners and threshold. */ nextConfig: Pick; }; type Args = { /** Complete current config. */ currentConfig: MultisigConfig.Config; /** Replacement owners and threshold. */ nextConfig: Pick; }; type ReturnValue = WriteContractReturnType; type ErrorType = BaseErrorType; /** @internal */ function inner(action: action, client: Client, parameters: Parameters): Promise>; /** * Defines a call to the `updateConfig` function. * * Can be passed as a parameter to: * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate gas * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the update * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): include the update in a call batch * * @example * ```ts * import { Actions, type MultisigConfig } from 'viem/tempo' * * declare const currentConfig: MultisigConfig.Config * * const call = Actions.multisig.updateConfig.call({ * currentConfig, * nextConfig: { * owners: [{ owner: '0x...', weight: 1 }], * threshold: 1, * }, * }) * ``` * * @param args - Current and replacement multisig configurations. * @returns The call. */ function call(args: Args): { abi: [{ readonly name: "updateConfig"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly type: "tuple"; readonly name: "current"; readonly components: readonly [{ readonly type: "bytes32"; readonly name: "salt"; }, { readonly type: "uint64"; readonly name: "version"; }, { readonly type: "uint8"; readonly name: "threshold"; }, { readonly type: "tuple[]"; readonly name: "owners"; readonly components: readonly [{ readonly type: "address"; readonly name: "owner"; }, { readonly type: "uint8"; readonly name: "weight"; }]; }]; }, { readonly type: "uint8"; readonly name: "threshold"; }, { readonly type: "tuple[]"; readonly name: "owners"; readonly components: readonly [{ readonly type: "address"; readonly name: "owner"; }, { readonly type: "uint8"; readonly name: "weight"; }]; }]; readonly outputs: readonly []; }]; functionName: "updateConfig"; } & { args: readonly [{ salt: `0x${string}`; version: bigint; threshold: number; owners: readonly { owner: `0x${string}`; weight: number; }[]; }, threshold: number, owners: readonly { owner: `0x${string}`; weight: number; }[]]; } & { address: Address; } & { data: import("../../index.js").Hex; to: Address; }; /** * Extracts the `MultisigConfigUpdated` event from logs. * * @param logs - Transaction logs. * @returns The configuration update event. */ function extractEvent(logs: Log[]): Log; } /** * Replaces a native multisig configuration and waits for confirmation. * * @example * ```ts * import { createWalletClient, custom, type EIP1193Provider } from 'viem' * import { tempo } from 'viem/chains' * import { Actions, type MultisigConfig } from 'viem/tempo' * * declare const provider: EIP1193Provider * declare const currentConfig: MultisigConfig.Config * * const client = createWalletClient({ * account: '0x...', * chain: tempo, * transport: custom(provider), * }) * * const { receipt } = await Actions.multisig.updateConfigSync(client, { * currentConfig, * nextConfig: { * owners: [{ owner: '0x...', weight: 1 }], * threshold: 1, * }, * }) * ``` * * @param client - Client. * @param parameters - Parameters. * @returns The updated configuration event and transaction receipt. */ export declare function updateConfigSync(client: Client, parameters: updateConfigSync.Parameters): Promise; export declare namespace updateConfigSync { type Parameters = updateConfig.Parameters; type Args = updateConfig.Args; type ReturnValue = Compute<{ account: Address; config: MultisigConfig.Config; receipt: Transaction.TransactionReceipt; }>; type ErrorType = updateConfig.ErrorType; } //# sourceMappingURL=multisig.d.ts.map