@towns-protocol/sdk
Version:
For more details, visit the following resources:
57 lines • 2.27 kB
TypeScript
import { PersistedObservable } from '../../../observable/persistedObservable';
import { Identifiable, Store } from '../../../store/store';
import { RiverConnection } from '../../river-connection/riverConnection';
import { Channel } from './channel';
import { ethers } from 'ethers';
import { SpaceDapp, SpaceInfo } from '@towns-protocol/web3';
import { Members } from '../../members/members';
export interface SpaceModel extends Identifiable {
/** The River `spaceId` of the space. */
id: string;
/** Whether the SyncAgent has loaded this space data. */
initialized: boolean;
/** The ids of the channels in the space. */
channelIds: string[];
/** The space metadata {@link SpaceInfo}. */
metadata?: SpaceInfo;
}
export declare class Space extends PersistedObservable<SpaceModel> {
private riverConnection;
private spaceDapp;
private channels;
members: Members;
constructor(id: string, riverConnection: RiverConnection, store: Store, spaceDapp: SpaceDapp);
protected onLoaded(): void;
/** Joins the space.
* @param signer - The signer to use to join the space.
* @param opts - Additional options for the join.
*/
join(signer: ethers.Signer, opts?: {
skipMintMembership?: boolean;
}): Promise<void>;
/** Creates a channel in the space.
* @param channelName - The name of the channel.
* @param signer - The signer to use to create the channel.
* @param opts - Additional options for the channel creation.
* @returns The `channelId` of the created channel.
*/
createChannel(channelName: string, signer: ethers.Signer, opts?: {
/** The topic of the channel. */
topic?: string;
}): Promise<string>;
/** Gets a channel by its id.
* @param channelId - The `channelId` of the channel.
* @returns The {@link Channel} model.
*/
getChannel(channelId: string): Channel;
/** Gets the default channel in the space.
* Every space has a default channel.
* @returns The {@link Channel} model.
*/
getDefaultChannel(): Channel;
private onStreamInitialized;
private onSpaceChannelCreated;
private onSpaceChannelDeleted;
private onSpaceChannelUpdated;
}
//# sourceMappingURL=space.d.ts.map