import type { Op } from '@geoprotocol/grc-20'; import { type Address, type Hex } from 'viem'; import type { Id } from '../id.js'; import type { PublishEditParams } from '../ipfs-core.js'; import type { GeoClientContext } from './context.js'; export type CreatePersonalSpaceParams = { name: string; accountAddress: Address; }; export type CreatePersonalSpaceResult = { to: `0x${string}`; calldata: `0x${string}`; spaceEntityId: Id; accountId: string; ops: Op[]; }; export type SetPersonalSpaceTopicParams = { spaceId: Id | string; topicId: Id | string; authorSpaceId?: Id | string; }; export type HasSpaceParams = { address: Hex; rpcUrl?: string; }; export type PublishPersonalSpaceEditParams = PublishEditParams & { spaceId: Id | string; }; /** * Builds the personal-space creation transaction and initial space content ops. * * The returned calldata registers the caller's address as a personal space. * The returned ops create the space entity, the account entity, and the * personal-space type relations that should be published after the space ID is * available onchain. * * @example * ```ts * const tx = geo.personalSpaces.create({ * name: 'Alice', * accountAddress: account.address, * }); * * await walletClient.sendTransaction({ * to: tx.to, * data: tx.calldata, * }); * * // Once the transaction is mined and the space ID is known: * await geo.personalSpaces.publishEdit({ * name: 'Create personal space profile', * spaceId, * author: spaceId, * ops: tx.ops, * }); * ``` * * @param context Client context containing the target network configuration. * @param params Space display name and account address to describe in initial ops. * @returns Target registry address, calldata, generated entity IDs, and initial content ops. * @throws When the configured network is missing `SPACE_REGISTRY_ADDRESS`. */ export declare function create(context: GeoClientContext, { name, accountAddress }: CreatePersonalSpaceParams): CreatePersonalSpaceResult; /** * Builds calldata for setting a personal space topic. * * Call this right after creating the personal space and publishing its initial * profile ops. For personal spaces, `authorSpaceId` defaults to `spaceId`. * * @example * ```ts * const topicTx = geo.personalSpaces.setTopic({ * spaceId, * topicId: createSpace.spaceEntityId, * }); * * await walletClient.sendTransaction({ * to: topicTx.to, * data: topicTx.calldata, * }); * ``` * * @param context Client context containing the target network configuration. * @param params Space ID, topic entity ID, and optional author space ID. * @returns Target registry address and calldata. * @throws When an ID is invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`. */ export declare function setTopic(context: GeoClientContext, { spaceId, topicId, authorSpaceId }: SetPersonalSpaceTopicParams): { to: `0x${string}`; calldata: `0x${string}`; }; /** * Checks whether an address already has a personal space on the configured network. * * The helper reads `addressToSpaceId(address)` from the configured * `SPACE_REGISTRY_ADDRESS`. Pass `rpcUrl` to override the network's configured * RPC URL for this lookup. * * @example * ```ts * const hasExistingSpace = await geo.personalSpaces.hasSpace({ * address: account.address, * }); * * if (!hasExistingSpace) { * const tx = geo.personalSpaces.create({ * name: 'Alice', * accountAddress: account.address, * }); * await walletClient.sendTransaction({ to: tx.to, data: tx.calldata }); * } * ``` * * @param context Client context containing network and contract configuration. * @param params Wallet or smart-account address plus optional RPC URL override. * @returns `true` when the registry maps the address to a non-empty space ID. * @throws When the configured network is missing `SPACE_REGISTRY_ADDRESS` or no RPC URL is available. */ export declare function hasSpace(context: GeoClientContext, { address, rpcUrl }: HasSpaceParams): Promise; /** * Publishes an edit and returns calldata for submitting it to a personal space. * * This is the context-explicit implementation behind * `geo.personalSpaces.publishEdit(...)`. * * @example * ```ts * import * as Ops from '@geoprotocol/geo-sdk/ops'; * * const { ops } = Ops.entities.create({ name: 'Geo entity' }); * const tx = await geo.personalSpaces.publishEdit({ * name: 'Create Geo entity', * spaceId, * author: spaceId, * ops, * }); * * await walletClient.sendTransaction({ * to: tx.to, * data: tx.calldata, * }); * ``` * * @param context Client context containing network, contract, API, and fetch configuration. * @param params Edit publication params plus the target personal space ID. * @returns Edit ID, CID, target registry address, and calldata. * @throws When the configured network is missing required contracts or edit publishing fails. */ export declare function publishEdit(context: GeoClientContext, params: PublishPersonalSpaceEditParams): Promise<{ editId: Id; cid: `ipfs://${string}`; to: `0x${string}`; calldata: `0x${string}`; }>; //# sourceMappingURL=personal-spaces.d.ts.map